Question

i have a edit page where i display information in

    <form:form method="POST" action="login.do" >
    <label for="msgTo" class="w80">To:</label> <input type="text"
                                id="msgTo" maxlength="15" size="20"
                                    value="${userLogin.userId}" />

in action class

    @RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(@ModelAttribute("userLogin") UserLogin obj) {   

Here, nothing of the form is coming in "UserLogin obj" object.

Please help.

Was it helpful?

Solution

If you are using spring-mvc tags consider using form in input as follows

      <form:input type="text" path="msgTo" maxlength="15" size="20" 
value="${userLogin.userId}" />

http://docs.spring.io/spring/docs/2.0.8/reference/spring-form.tld.html#spring-form.tld.input

If you want to user @ModelAttribute combining with spring tags, consider read this

Basically you need to use spring.tld in your form and create a bean that has bean properties equals to the name of the elements in the form.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top