title: NumberFormatException in a jsp with a list
body: <p>This question is another problem im having with my application which is described <a href="https://stackoverflow.com/questions/8235049/spring-mvc-binding-issue">here</a>. My model (a level) has a list of requirements which contains two strings, an id and name. The model looks like this:</p>
  
  <pre><code>public class Level {
  private String name;
  private int id;
  private int points
  private List&lt;Requirement&gt; requirements;
      ....
  }
  
  public class Requirement{
      private String name;
      private String id;
      ....
  }
  </code></pre>
  
  <p>and the jsp looks like this:</p>
  
  <pre><code>&lt;div id="allRequirements"&gt;
      &lt;c:forEach var="requirement" items="${RequirementList}"&gt;
           &lt;div class="requirements"&gt;
               &lt;input type="hidden" value="${requirement.id}" name="id"/&gt;
               &lt;h2&gt;&lt;c:out value="${requirement.name}"/&gt;&lt;/h2&gt;
           &lt;/div&gt;
      &lt;/c:foreach&gt;
  &lt;/div&gt;
  
  &lt;div id="requiredRequirements"&gt;
      &lt;c:forEach var="requiredRequirement" items="${level.requirements}"&gt;
           &lt;div class="requirements"&gt;
               &lt;input type="hidden" value="${requiredRequirement.id}" name="id"/&gt;
               &lt;h2&gt;&lt;c:out value="${requiredRequirement.name}"/&gt;&lt;/h2&gt;
           &lt;/div&gt;
      &lt;/c:foreach&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The jsp page renders fine and works like a charm until I added the requiredRequirements loop in which the site throws a <code>java.lang.NumberFormatException: For input string: "id"</code> because it tries to parse the string as an int.</p>
  
  <p>Does anyone have any idea why the first loop works and the second loop does not work?</p>
  
  <p><strong>Edit:
  Stack trace</strong></p>
  
  <pre><code>java.lang.NumberFormatException: For input string: "id"
  at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
  at java.lang.Integer.parseInt(Integer.java:447)
  at java.lang.Integer.parseInt(Integer.java:497)
  at javax.el.ListELResolver.coerce(ListELResolver.java:174)
  at javax.el.ListELResolver.getValue(ListELResolver.java:52)
  at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
  at org.apache.el.parser.AstValue.getValue(AstValue.java:169)
  at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
  at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:985)
  at org.apache.jsp.WEB_002dINF.jsp.createOrEdit_005fLevelBody_jsp._jspx_meth_c_005fout_005f0(createOrEdit_005fLevelBody_jsp.java:648)
  at org.apache.jsp.WEB_002dINF.jsp.createOrEdit_005fLevelBody_jsp._jspx_meth_c_005fforEach_005f1(createOrEdit_005fLevelBody_jsp.java:611)
  at org.apache.jsp.WEB_002dINF.jsp.createOrEdit_005fLevelBody_jsp._jspService(createOrEdit_005fLevelBody_jsp.java:207)
  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
  at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
  at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
  at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:927)
  at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:684)
  at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:678)
  at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:103)
  at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96)
  at org.apache.tiles.renderer.impl.UntypedAttributeRenderer.write(UntypedAttributeRenderer.java:61)
  at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:103)
  at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:659)
  at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:337)
  at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:234)
  at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:211)
  at org.apache.tiles.jsp.taglib.RenderTag.doEndTag(RenderTag.java:220)
  at org.apache.jsp.WEB_002dINF.jsp.layout_jsp._jspx_meth_tiles_005finsertAttribute_005f3(layout_jsp.java:411)
  at org.apache.jsp.WEB_002dINF.jsp.layout_jsp._jspService(layout_jsp.java:196)
  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
  at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
  at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
  at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:927)
  at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:684)
  at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:678)
  at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:103)
  at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96)
  at org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44)
  at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:103)
  at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:659)
  at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:678)
  at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:633)
  at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:322)
  at org.apache.tiles.jsp.taglib.InsertDefinitionTag.renderContext(InsertDefinitionTag.java:66)
  at org.apache.tiles.jsp.taglib.InsertTemplateTag.render(InsertTemplateTag.java:81)
  at org.apache.tiles.jsp.taglib.RenderTag.doEndTag(RenderTag.java:220)
  at org.apache.jsp.WEB_002dINF.jsp.createOrEdit_005fLevel_jsp._jspx_meth_tiles_005finsertDefinition_005f0(createOrEdit_005fLevel_jsp.java:87)
  at org.apache.jsp.WEB_002dINF.jsp.createOrEdit_005fLevel_jsp._jspService(createOrEdit_005fLevel_jsp.java:60)
  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
  at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
  at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
  at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
  at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
  at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
  at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
  at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:306)
  at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:323)
  at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1719)
  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
  at java.lang.Thread.run(Thread.java:619)
  </code></pre>
  
  <p>Thanks</p>