2012-09-12 46 views
0

我AVING一個問題與讓我與Maven和Eclipse第一webproject ...有讓我與Maven和Eclipse

第一webproject有問題,我是新來使用maven,我努力學習它。我一直在使用Eclipse和編碼Web和Spring項目很長一段時間,但從未使用Maven,所以我想學習它。

我創建新Maven項目使用的原型:Maven的原型 - web應用從日食內,則讓我改變我的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?

回答

3

的URI的JSTL應該是這樣的:

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

見的討論here以獲取更多信息。

+1

但是<%@ taglib prefix =「fn」uri =「http://java.sun.com/jstl/functions」%> –

1

您需要添加servlet api作爲依賴項並將其標記爲提供。或者尋找maven taglib的依賴關係:

<dependency> 
    <groupId>jstl</groupId> 
    <artifactId>jstl</artifactId> 
    <version>1.2</version> 
</dependency>