0

Maven と Eclipse を使用して最初の Web プロジェクトを作成する際に問題が発生しています...

私はmavenを使用するのが初めてで、それを学ぼうとしています。私は長い間 Eclipse と Coding Web および Spring プロジェクトを使用してきましたが、maven を使用したことがないので、それを学びたいと考えています。

eclipse 内から archetype: maven-archetype-webapp を使用して新しい Maven プロジェクトを作成し、POM.XML を次のように変更します。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.springsource.greenbeans.maven</groupId>
    <artifactId>WebFlowTemplate</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>WebFlowTemplate Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>3.1.2.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.webflow</groupId>
            <artifactId>spring-webflow</artifactId>
            <version>2.3.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>3.1.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>3.1.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>3.1.2.RELEASE</version>
        </dependency>


        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

    </dependencies>
    <build>
        <finalName>WebFlowTemplate</finalName>
    </build>
</project>

次に、テスト用に小さな index.jsp を作成しました。

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<html>
<head>
    <title>Spring 3.0 MVC Series</title>
</head>
<body>
    <a href="login.jsp">Login</a><p><p>
    <a href="hello.html">Say Hello (Spring MVC)</a><p>
    <a href="./helloworld">Say Hello (Spring-Web-Flow)</a>
</body>
</html>

しかし、taglib 行でエラーが発生します。

説明 リソース パス ロケーション タイプ

Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core" input.jsp   /WebFlowTemplate/src/main/webapp/WEB-INF/flows/helloworld   line 1  JSP Problem

JSP が taglibs を見つけられないのはなぜですか?

4

2 に答える 2

3

jstl の URI は次のようになります。

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

詳細については、こちらのディスカッションを参照してください。

于 2012-09-12T16:17:20.113 に答える
1

サーブレット API を依存関係として追加し、提供済みとしてマークする必要があります。または、maven taglib の依存関係を探します。

<dependency>
    <groupId>jstl</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>
于 2012-09-12T16:17:22.953 に答える