title: How do I populate hidden form field with a value set in Spring Controller
body: <p>All,</p>
  
  <p>I have a controller action in Spring MVC. This action is setting an attribute. I want this attribute to be set as a hidden value in the form.</p>
  
  <p>Here's my controller action:</p>
  
  <pre><code>@RequestMapping(method = RequestMethod.GET)
      public String showLoginForm(HttpServletRequest request, ModelMap model) 
      {
          //URL to redirect the User to after Authentication
          String gotoUrl = request.getParameter("goto");
  
          LoginForm loginForm = new LoginForm();
          model.addAttribute("gotoUrl", gotoUrl);
          model.put("loginForm", loginForm);
          return "loginform";
      }
  </code></pre>
  
  <p>In the JSP Form, I want something like this:</p>
  
  <pre><code>&lt;input type="hidden" name="goto" id="goto" value="${gotoUrl}" /&gt;
  </code></pre>
  
  <p>But, this is not valid syntax according to JSP. Can you please suggest the valid syntax?</p>
  
  <p>Thanks,</p>
  
  <p>This is the stacktrace error:</p>
  
  <pre><code>javax.el.ELException: The identifier [gotoUrl] is not a valid Java identifier as required by section 1.19 of the EL specification (Identifier ::= Java language identifier). This check can be disabled by setting the system property org.apache.el.parser.SKIP_IDENTIFIER_CHECK to true.
      org.apache.el.parser.AstIdentifier.setImage(AstIdentifier.java:132)
      org.apache.el.parser.ELParser.Identifier(ELParser.java:1215)
      org.apache.el.parser.ELParser.NonLiteral(ELParser.java:1191)
      org.apache.el.parser.ELParser.ValuePrefix(ELParser.java:1017)
      org.apache.el.parser.ELParser.Value(ELParser.java:966)
      org.apache.el.parser.ELParser.Unary(ELParser.java:948)
      org.apache.el.parser.ELParser.Multiplication(ELParser.java:712)
      org.apache.el.parser.ELParser.Math(ELParser.java:632)
      org.apache.el.parser.ELParser.Compare(ELParser.java:444)
      org.apache.el.parser.ELParser.Equality(ELParser.java:338)
      org.apache.el.parser.ELParser.And(ELParser.java:282)
      org.apache.el.parser.ELParser.Or(ELParser.java:226)
      org.apache.el.parser.ELParser.Choice(ELParser.java:183)
      org.apache.el.parser.ELParser.Expression(ELParser.java:175)
      org.apache.el.parser.ELParser.DynamicExpression(ELParser.java:147)
      org.apache.el.parser.ELParser.CompositeExpression(ELParser.java:44)
      org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:116)
      org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:172)
      org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:217)
      org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:67)
      org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:984)
      org.apache.jsp.WEB_002dINF.views.loginform_jsp._jspService(loginform_jsp.java:176)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:263)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
      org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  </code></pre>