title: org.apache.jasper.JasperException: /WEB-INF/views/home.jsp (line: [25], column: [1]) Unable to find setter method for attribute: [commandName]
body: <p>I have created a spring form and want to submit this from and display another jsp page. When i run this project i get the below exception. can anyone help me to understand why i am getting this error.</p>
  
  <pre><code>org.apache.jasper.JasperException: /WEB-INF/views/home.jsp (line: [25], column: [1]) Unable to find setter method for attribute: [commandName]
      org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
      org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:292)
      org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:115)
      org.apache.jasper.compiler.Generator$GenerateVisitor.evaluateAttribute(Generator.java:2998)
      org.apache.jasper.compiler.Generator$GenerateVisitor.generateSetters(Generator.java:3218)
      org.apache.jasper.compiler.Generator$GenerateVisitor.generateCustomStart(Generator.java:2404)
      org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1894)
      org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1544)
      org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2389)
      org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2441)
      org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2447)
      org.apache.jasper.compiler.Node$Root.accept(Node.java:470)
      org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2389)
      org.apache.jasper.compiler.Generator.generate(Generator.java:3657)
      org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:256)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:384)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:361)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:345)
      org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
      org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:170)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:312)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1325)
      org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1069)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1008)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:870)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:855)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
  </code></pre>
  
  <p>JSP File :</p>
  
  <pre><code>&lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;
  &lt;%@ page session="false" %&gt;
  &lt;%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Home&lt;/title&gt;
      &lt;style&gt;
  .error {
      color: #ff0000;
  }
  
  .errorblock {
      color: #000;
      background-color: #ffEEEE;
      border: 3px solid #ff0000;
      padding: 8px;
      margin: 16px;
  }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h2&gt;Spring's form textbox example&lt;/h2&gt;
  
      &lt;form:form method="POST" action="/customer" commandName="customer"&gt;
          &lt;form:errors path="*" cssClass="errorblock" element="div" /&gt;
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;td&gt;Username :&lt;/td&gt;
                  &lt;td&gt;&lt;form:input path="userName" /&gt;
                  &lt;/td&gt;
                  &lt;td&gt;&lt;form:errors path="userName" cssClass="error" /&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td colspan="3"&gt;&lt;input type="submit" /&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/form:form&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>When i use simple html form then it works properly but same thing if i am doing it through spring form it gives the error. </p>
  
  <p>Controller Class :</p>
  
  <pre><code>@Controller
  public class HomeController {
  
  
      @RequestMapping("/")
      public String welcomePage()
      {
          return "home";
      }
  
  
      @RequestMapping(value="/customer", method=RequestMethod.POST)
      public ModelAndView submitForm(@RequestParam("userName") String name)
      {       
          ModelAndView mv = new ModelAndView("success");
          mv.addObject("userName", name);
          return mv;
      }
  }
  </code></pre>