2016-03-22 12 views
0

私のプロジェクトに問題があります。 pom.xmlエラー:org.apache.jasper.JasperException。どのようにそれを修正する?

<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>edu.java.spring.service</groupId> 
    <artifactId>springDAT-service</artifactId> 
    <packaging>war</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>springDAT-service 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-core</artifactId> 
     <version>4.0.3.RELEASE</version> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-context</artifactId> 
     <version>4.0.3.RELEASE</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-context-support</artifactId> 
     <version>4.0.3.RELEASE</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-web</artifactId> 
     <version>4.0.3.RELEASE</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-webmvc</artifactId> 
     <version>4.0.3.RELEASE</version> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-orm</artifactId> 
     <version>4.0.3.RELEASE</version> 
    </dependency> 

    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-core</artifactId> 
     <version>5.1.0.Final</version> 
    </dependency> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>servlet-api</artifactId> 
     <version>2.5</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.derby</groupId> 
     <artifactId>derby</artifactId> 
     <version>10.12.1.1</version> 
    </dependency> 

    <dependency> 
    <groupId>org.codehaus.jackson</groupId> 
    <artifactId>jackson-mapper-asl</artifactId> 
    <version>1.9.13</version> 
</dependency> 
    <dependency> 
    <groupId>jstl</groupId> 
    <artifactId>jstl</artifactId> 
    <version>1.2</version> 
</dependency> 

    </dependencies> 
    <build> 
    <finalName>springMOTHER-service</finalName> 
    <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.12.4</version> 
       <configuration> 
        <skipTests>true</skipTests> 
        <argLine>-Xmx2524m</argLine> 
       </configuration> 
      </plugin> 

      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.1</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
        <encoding>UTF-8</encoding> 
        <fork>true</fork> 
        <compilerArgs> 
         <arg>-XDignore.symbol.file</arg> 
        </compilerArgs> 
       </configuration> 
      </plugin> 

      <plugin> 
       <groupId>org.eclipse.jetty</groupId> 
       <artifactId>jetty-maven-plugin</artifactId> 
       <version>9.3.0.M1</version> 
       <configuration> 
        <jvmArgs>-Xmx1048m -Xms536m 
         -XX:PermSize=128m -XX:MaxPermSize=512m</jvmArgs> 
        <reload>manual</reload> 
        <systemProperties> 
         <systemProperty> 
          <name>lib</name> 
          <value>${basedir}/target/spring-mvc/WEB-INF/lib</value> 
         </systemProperty> 
        </systemProperties> 
        <scanIntervalSeconds>3</scanIntervalSeconds> 
        <connectors> 
         <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> 
          <port>8080</port> 
          <maxIdleTime>60000</maxIdleTime> 
         </connector> 
        </connectors> 
        <contextPath>/</contextPath> 
        <webAppSourceDirectory>${basedir}/src/main/webapp</webAppSourceDirectory> 
        <webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml> 
        <classesDirectory>${basedir}/target/classes</classesDirectory> 
       </configuration> 
      </plugin> 

     </plugins> 

    </build> 
</project> 
ファイルここ Gender.java

package edu.java.spring.service.user.model; 

public enum Gender { 
    MALE("Male"), 
    FEMALE("Female"), 
    OTHER("Other"); 
    private String name; 

    private Gender(String name) { 
     this.name = name; 
    } 

    public String getGender(){ 
     return this.name; 
    } 



} 

ファイルここUserForm.jsp

<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %> 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>   
<html> 
    <head> 
     <title>Add New User</title> 
    </head> 
<body> 
<h2>Please Input User Information</h2> 

    <form:form method="POST" modelAttribute="User" action=""> 
     <table> 
      <tr> 
       <td><form:label path="userName">UserName</form:label></td> 
       <td><form:input path="userName"/></td> 
       <td><form:errors path="userName" /></td> 
      </tr> 
      <tr> 
       <td><form:label path="passWord">Password</form:label></td> 
       <td><form:input path="passWord"/></td> 
       <td><form:errors path="passWord" /></td> 
      </tr> 


      <tr> 
       <td><form:label path="birthDay">Birthday</form:label></td> 
       <td><form:input path="birthDay" type = "date"/> </td> 

       <td><form:errors path="birthDay"/> </td> 
      </tr> 

      <tr> 
       <td><form:label path="age">Age</form:label> 
       <td><form:input path="age" type = "number"/> </td> 
       <td><form:errors path="age"></form:errors> </td> 
      </tr> 

      <tr> 
       <td><form:label path="gender">Gender</form:label></td> 
       <td><form:select path="gender"> 
         <c:forEach var="temp" items="${allgender}"> 

          <form:option value="${temp}"> 
           <spring:message code="${temp.gender}"/> 
          </form:option> 
         </c:forEach> 

        </form:select></td> 
       <td><form:errors path="gender"></form:errors></td> 
      </tr> 





      <tr><td colspan="3"><input type="submit" value="Submit" /></td></tr> 
     </table> 
    </form:form> 

</body> 
</html> 

ファイルここ

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet .jsp.JspTagException: No message found under code 'Male' for locale 'en_US'. at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspSer vletWrapper.java:585) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper .java:455) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:4 05) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:349) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:801 ) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java :587) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.j ava:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.jav a:595) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandl er.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandl er.java:1126) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java: 515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandle r.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandle r.java:1060) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.j ava:141) at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:200) at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:75) at org.springframework.web.servlet.view.InternalResourceView.renderMerge dOutputModel(InternalResourceView.java:209) at org.springframework.web.servlet.view.AbstractView.render(AbstractView .java:267) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherSe rvlet.java:1217) at org.springframework.web.servlet.DispatcherServlet.processDispatchResu lt(DispatcherServlet.java:1005) at org.springframework.web.servlet.DispatcherServlet.doDispatch(Dispatch erServlet.java:952) at org.springframework.web.servlet.DispatcherServlet.doService(Dispatche rServlet.java:870) at org.springframework.web.servlet.FrameworkServlet.processRequest(Frame workServlet.java:961) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServl et.java:852) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkSer vlet.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:801 ) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java :587) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.j ava:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.jav a:577) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandl er.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandl er.java:1126) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java: 515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandle r.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandle r.java:1060) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.j ava:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(Cont extHandlerCollection.java:215) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerColl ection.java:110) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper .java:113) at org.eclipse.jetty.server.Server.handle(Server.java:509) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:288) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.jav a:240) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java :539) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPoo l.java:620) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool .java:540) at java.lang.Thread.run(Thread.java:745) Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspTagException: No message found under code 'Male' for locale 'en_US'. at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageC ontextImpl.java:905) at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageCon textImpl.java:834) at org.apache.jsp.WEB_002dINF.pages.UserForm_jsp._jspService(UserForm_js p.java:444) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper .java:432) ... 46 more Caused by: javax.servlet.jsp.JspTagException: No message found under code 'Male' for locale 'en_US'. at org.springframework.web.servlet.tags.MessageTag.doEndTag(MessageTag.j ava:202) at org.apache.jsp.WEB_002dINF.pages.UserForm_jsp._jspx_meth_spring_005fm essage_005f0(UserForm_jsp.java:754) at org.apache.jsp.WEB_002dINF.pages.UserForm_jsp._jspService(UserForm_js p.java:318)

:私は、ユーザーフォームを表示するが、次のエラーが発生するhttp://localhost:8080/user/formをブラウワーとき10

+0

あなたはどこかのライブラリが不足しています。依存関係を投稿できますか? – Desorder

+0

@Desorder、投稿に 'pom.xml'ファイルを追加しました –

+0

Javaのキーワード(そしておそらくJSPのELキーワード)である' enum'以外のものを使ってみましたか? –

答えて

0

<spring:message>を使用して<option>タグの値を印刷しようとしていますが、<spring:message>が持っていないプロパティファイルからラベルをロードしようとしています。

<c:foreach />タグ全体を<form:options itemLabel="gender" />の代わりに使用してください。

関連する問題