title: java.lang.NumberFormatException: For input string: "id" while trying to retrive related table column to jsp selectbox
body: <p>This question kind of related to a previous one at
  <a href="https://stackoverflow.com/questions/69549816/could-not-create-query-for-public-abstract-org-springframework-data-domain-page/69550083#69550083">Could not create query for public abstract org.springframework.data.domain.Page com.example.repository.DocumentsRepository.findBytypeid</a></p>
  <p>Thank to all it was resolved. But now I have an other problem I am trying to make a selectbox with all rows from related column. Here is my JSP form</p>
  <pre><code>&lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=UTF-8&quot;
      pageEncoding=&quot;UTF-8&quot;%&gt;
  &lt;%@ taglib uri=&quot;http://www.springframework.org/tags&quot; prefix=&quot;spring&quot;%&gt; 
  &lt;%@ taglib uri=&quot;http://www.springframework.org/tags/form&quot; prefix=&quot;form&quot;%&gt;   
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset=&quot;UTF-8&quot;&gt;
  &lt;title&gt;Добавить отдел&lt;/title&gt;
   &lt;link href=&quot;../../webjars/bootstrap/4.0.0/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot; /&gt;
   &lt;script src=&quot;../../webjars/bootstrap/4.0.0/js/bootstrap.min.js&quot;&gt;&lt;/script&gt;
   &lt;script src=&quot;../../webjars/jquery/3.0.0/js/jquery.min.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class=&quot;container&quot;&gt;
    &lt;spring:url value=&quot;/document/add&quot; var=&quot;addURL&quot; /&gt;
    &lt;h2&gt;Добавить документ&lt;/h2&gt;
    &lt;form:form modelAttribute=&quot;documentForm&quot; method=&quot;post&quot; action=&quot;${addURL}&quot; cssClass=&quot;form&quot; &gt;
     &lt;form:hidden path=&quot;id&quot;/&gt;
     &lt;div class=&quot;form-group&quot;&gt;
      &lt;label&gt;Название&lt;/label&gt;
      &lt;form:input path=&quot;name&quot; cssClass=&quot;form-control&quot; id=&quot;firstname&quot; /&gt;
     &lt;/div&gt;
    
     &lt;div class=&quot;form-group&quot;&gt;
      &lt;label&gt;Тип документа&lt;/label&gt;
   &lt;form:select path=&quot;typeid&quot;&gt;
                 
                  &lt;c:forEach var=&quot;documenttypeslist&quot; items=&quot;${documenttypesList}&quot;&gt;
                      &lt;form:option value=&quot;${documenttypesList.id}&quot; label=&quot;${documenttypesList.documenttype}&quot;/&gt;
                  &lt;/c:forEach&gt;
              &lt;/form:select&gt;
     &lt;/div&gt;
     
      &lt;div class=&quot;form-group&quot;&gt;
      &lt;label&gt;Файл документа&lt;/label&gt;
      &lt;form:input path=&quot;file&quot; cssClass=&quot;form-control&quot; id=&quot;firstname&quot; /&gt;
     &lt;/div&gt;
    
     &lt;button type=&quot;submit&quot; class=&quot;btn btn-success&quot;&gt;Сохранить&lt;/button&gt;
    &lt;/form:form&gt;
    
   &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>And part of my controller to add rows:</p>
  <pre><code>public ModelAndView addDocument()
       {
          ModelAndView model= new ModelAndView();
          Documents documents= new Documents();
           List&lt;Documenttypes&gt; documenttypesList=documenttypesService.getAllDocumenttypes();
              
          model.addObject(&quot;documentForm&quot;, documents);
          model.addObject(&quot;documenttypesList&quot;, documenttypesList);
          
          model.setViewName(&quot;documents_form&quot;);
          return model;
       }
      
  </code></pre>
  <p>And I get the following exception:</p>
  <pre><code>java.lang.NumberFormatException: For input string: &quot;id&quot;
      at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) ~[na:na]
      at java.base/java.lang.Integer.parseInt(Integer.java:668) ~[na:na]
      at java.base/java.lang.Integer.parseInt(Integer.java:786) ~[na:na]
      at javax.el.ListELResolver.coerce(ListELResolver.java:148) ~[tomcat-embed-el-9.0.53.jar:3.0.FR]
      at javax.el.ListELResolver.getValue(ListELResolver.java:65) ~[tomcat-embed-el-9.0.53.jar:3.0.FR]
      at org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:124) ~[tomcat-embed-jasper-9.0.53.jar:9.0.53]
      at org.apache.el.parser.AstValue.getValue(AstValue.java:168) ~[tomcat-embed-el-9.0.53.jar:9.0.53]
      at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) ~[tomcat-embed-el-9.0.53.jar:9.0.53]
      at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:692) ~[tomcat-embed-jasper-9.0.53.jar:9.0.53]
      at org.apache.jsp.WEB_002dINF.jsp.documents_005fform_jsp._jspService(documents_005fform_jsp.java:223) ~[na:na]
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) ~[tomcat-embed-jasper-9.0.53.jar:9.0.53]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.53.jar:4.0.FR]
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466) ~[tomcat-embed-jasper-9.0.53.jar:9.0.53]
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379) ~[tomcat-embed-jasper-9.0.53.jar:9.0.53]
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:327) ~[tomcat-embed-jasper-9.0.53.jar:9.0.53]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.53.jar:4.0.FR]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) ~[spring-web-5.3.10.jar:5.3.10]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) ~[spring-web-5.3.10.jar:5.3.10]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) ~[spring-web-5.3.10.jar:5.3.10]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:711) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:385) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:313) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:171) ~[spring-webmvc-5.3.10.jar:5.3.10]
      at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316) ~[spring-webmvc-5.3.10.jar:5.3.10]
      at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1400) ~[spring-webmvc-5.3.10.jar:5.3.10]
      at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1145) ~[spring-webmvc-5.3.10.jar:5.3.10]
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1084) ~[spring-webmvc-5.3.10.jar:5.3.10]
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.10.jar:5.3.10]
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.10.jar:5.3.10]
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.10.jar:5.3.10]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:655) ~[tomcat-embed-core-9.0.53.jar:4.0.FR]
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.10.jar:5.3.10]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.53.jar:4.0.FR]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.10.jar:5.3.10]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.10.jar:5.3.10]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.10.jar:5.3.10]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.10.jar:5.3.10]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.10.jar:5.3.10]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.10.jar:5.3.10]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1726) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.53.jar:9.0.53]
      at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
  </code></pre>
  <p>I am willing to provide more code if nessary, But it duplicates my previous question</p>
  <p>I probably should add here my whole controller. May be it will be helpful.</p>
  <pre><code>package com.example.controller;
  import java.util.List;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.ModelAttribute;
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.servlet.ModelAndView;
  
  import com.example.model.Documenttypes;
  import com.example.model.Documents;
  import com.example.services.DocumenttypesService;
  import com.example.services.DocumentsService;
  
  @Controller
  @RequestMapping(value=&quot;/document&quot;)
  @SpringBootApplication
  
  public class DocumentsController {
      @Autowired
      DocumentsService documentsService;
      
      @Autowired
      DocumenttypesService documenttypesService;
      
      @RequestMapping(value=&quot;/list&quot;, method=RequestMethod.GET)
       public ModelAndView list()
       {
           ModelAndView model=new  ModelAndView(&quot;documents_list&quot;);
           List&lt;Documents&gt; documentsList=documentsService.getAllDocuments();
            model.addObject(&quot;documentsList&quot;, documentsList);
            return model;
  
       }
       
       @RequestMapping(value=&quot;/add/&quot;, method=RequestMethod.GET)
          
       public ModelAndView addDocument()
       {
          ModelAndView model= new ModelAndView();
          Documents documents= new Documents();
           List&lt;Documenttypes&gt; documenttypesList=documenttypesService.getAllDocumenttypes();
              
          model.addObject(&quot;documentForm&quot;, documents);
          model.addObject(&quot;documenttypeslist&quot;, documenttypesList);
          
          model.setViewName(&quot;documents_form&quot;);
          return model;
       }
       
       @RequestMapping(value=&quot;/editdocument/{id}&quot;, method=RequestMethod.GET)
          
       public ModelAndView editDocument(@PathVariable int id)
       {
           ModelAndView model = new ModelAndView();
            Documents documents = documentsService.getDocumentById(id);
            model.addObject(&quot;documentForm&quot;, documents);
              model.setViewName(&quot;documents_form&quot;);
              return model;
       }
       
       @RequestMapping(value=&quot;/add&quot;, method=RequestMethod.POST)
       public ModelAndView add(@ModelAttribute(&quot;documentsForm&quot;) Documents documents)
       {
          documentsService.addDocument(documents);
           return new ModelAndView(&quot;redirect:/document/list&quot;);
           
       }
       
       @RequestMapping(value=&quot;/deletedocument/{id}&quot;, method=RequestMethod.GET)
       public ModelAndView delete(@PathVariable(&quot;id&quot;) int id)
       {
           documentsService.deleteDocument(id);
           return new ModelAndView(&quot;redirect:/document/list&quot;);
           
       }
  }
  </code></pre>