Controller
public class UserDtls extends SimpleFormController {
protected ModelAndView processFormSubmission(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
User user=(User)command;
System.out.println("User name is "+user.getUserName());
System.out.println("User location is "+user.getLocation());
return new ModelAndView("First","user",user);
}
}
Mapping in Dispatcher
Servlet
<bean id="userDtls" class="com.training.controller.UserDtls">
<property name="commandName">
<value>user</value>
</property>
<property name="commandClass">
<value>com.training.beans.User</value>
</property>
<property name="formView">
<value>welcome</value>
</property>
</bean>
Code in the jsp
<form:form name="user" commandName="user" action="user.htm" method="post">
Welcome To Spring Training |
Name<form:input path="userName"/>
|
<input type="submit" value="submit">
|
</form:form>
Thank for your reply