2016-10-19 7 views
-1

JstlはMavenの単純なプロジェクトでは動作しませんか?私のpom.xmlファイルは正しいですか?JstlはMavenの単純なプロジェクトでは動作しませんか?

のpom.xml

<dependency> 
    <groupId>javax.servlet</groupId> 
    <artifactId>javax.servlet-api</artifactId> 
    <version>3.1.0</version> 
    <scope>provided</scope> 
</dependency> 
<dependency> 
    <groupId>javax.servlet.jsp</groupId> 
    <artifactId>javax.servlet.jsp-api</artifactId> 
    <version>2.3.1</version> 
    <scope>provided</scope> 
</dependency> 
<dependency> 
    <groupId>jstl</groupId> 
    <artifactId>jstl</artifactId> 
    <version>1.2</version>  
</dependency> 

web.xmlの

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 
     version="3.1"> 
    <display-name>Archetype Created Web Application</display-name> 

<context-param> 
     <param-name>contextClass</param-name> 
     <param-value> 
      org.springframework.web.context.support.AnnotationConfigWebApplicationContext 
     </param-value> 
    </context-param> 
    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 

    <servlet> 
     <servlet-name>SpringDispatcher</servlet-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
     <init-param> 
      <param-name>contextClass</param-name> 
      <param-value> 
       org.springframework.web.context.support.AnnotationConfigWebApplicationContext 
      </param-value> 
     </init-param> 
     <init-param> 
      <param-name>contextConfigLocation</param-name> 
      <param-value>com</param-value> 
     </init-param> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>SpringDispatcher</servlet-name> 
     <url-pattern>/</url-pattern> 
    </servlet-mapping> 

    <session-config> 
     <session-timeout>30</session-timeout> 
    </session-config> 
</web-app> 

私のビューページには、次のとおりです。

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" 
    pageEncoding="ISO-8859-1"%> 
<%@ page isELIgnored="true" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<title>Insert title here</title> 
</head> 
<body> 
<c:forEach var="i" begin="1" end="5"> 
    Item <c:out value="${i}"/><p> 
</c:forEach> 

</table> 
</body> 
</html> 

出力は次のとおりです。

Item ${i} 
Item ${i} 

Item ${i} 

Item ${i} 

Item ${i} 

このプログラムでは私のミスは何ですか?私はそれ<%@ page isELIgnored="false" %>作り、あなたは問題ないはずすべてが<%@ page isELIgnored="true" %> を除き、あなたのコードで罰金だと思います。このプログラム

答えて

0

上の解決策が何であるかを教えてください。

また、javax.servletのjstlを使用しました。あなたはそれを試すことができますも `

<dependency> 
    <groupId>javax.servlet</groupId> 
    <artifactId>jstl</artifactId> 
    <version>1.2</version> 
</dependency> 

`

関連する問題