1

I want to handle simple form. Here's form from my signUp.jsp, where from I receive my data

<form:form method="POST" commandName="user-entity" action="process.html">
<table>
    <tr>
        <td><form:label path="userName">Name:</form:label></td>
        <td><form:input path="userName" /></td>
    </tr>
    <tr>
        <td><form:label path="label">Age:</form:label></td>
        <td><form:label path="label"/></td>
    </tr>
    <tr>
        <td colspan="2">
            <input type="submit" value="Submit"/>
        </td>
        <td></td>
        <td></td>
    </tr>
</table>  
</form:form>

And part of my result.jsp

<p>User's name is ${user.userName}. The age is ${user.age}.</p>

And UserController.java

    @Controller
    public class UserController {
        @RequestMapping(value = "/signUp")
        public ModelAndView signUpPage() {
            return new ModelAndView("signUp", "user-entity", new User());
        }

        @RequestMapping(value = "/process")
        public ModelAndView processUser(@ModelAttribute User user) {
            ModelAndView model = new ModelAndView();
            model.setViewName("result");
            model.addObject("user", user);
            return model;
        }

    }

As the result I get

User's name is ${user.userName}. The age is ${user.password}. and i have no idea why. Where might be the problem?

dawidklos
  • 902
  • 1
  • 9
  • 32

1 Answers1

0

Missing <%@ page isELIgnored="false"%> in result.jsp

Solution brought from here

Community
  • 1
  • 1
dawidklos
  • 902
  • 1
  • 9
  • 32