SHARE
TWEET

Untitled

a guest Aug 17th, 2018 120 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. How to Set Form Bean before it goes to JSP page
  2. @ActionMapping(params = "spring_action=resetPasswordViewAction")
  3. protected void resetPasswordAction(ActionRequest actionRequest, Map<String, Object> model, ActionResponse actionResponse, @RequestParam String customerId, @RequestParam String userName) {
  4.     model.put("customerId", customerId);//Preload form bean value with this
  5.     model.put("userName", userName);//Preload form bean value with this
  6.     actionResponse.setRenderParameter("spring_render", "resetPasswordView");
  7. }
  8.  
  9. @RenderMapping(params = "spring_render=resetPasswordView")
  10. protected ModelAndView resetPasswordView(RenderRequest renderRequest, Map<String, Object> model) {
  11.     return new ModelAndView("resetPassword", model);
  12. }
  13.  
  14. @ActionMapping(params = "spring_action=resetPasswordUpdateAction")
  15. protected void resetPasswordUpdateAction(ActionRequest actionRequest, Map<String, Object> model, ActionResponse actionResponse, final ResetPassword resetPasswordCriteria) {
  16.     LOG.info(resetPasswordCriteria.toString());// Form values are retrieved successfully
  17.     actionResponse.setRenderParameter("spring_render", "resetPasswordView");
  18. }
  19.  
  20. @ModelAttribute("resetPasswordCriteria")
  21. public ResetPassword getResetPasswordCriteria() {
  22.     return new ResetPassword();
  23. }
  24.    
  25. <form:form id="resetPasswordForm" name="resetPasswordForm" commandName="resetPasswordCriteria" method="post" action="${resetPasswordUpdateActionURL}">
  26.  
  27.     <form:label path="customerId" /><!--Preload this field value-->
  28.     <form:label path="userName" /><!--Preload this field value-->
  29.     <form:password path="password" />
  30.     <form:password path="confirmPassword" />
  31.     <input type="submit" value="Submit" />
  32.  
  33. </form:form>
  34.    
  35. public class ResetPassword {
  36.     private String customerId = "";
  37.     private String userName = "";
  38.     private String password = "";
  39.     private String confirmPassword = "";
  40.     //Getters Setters
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top