mardi 7 avril 2015

How to know from which jsp page the request has come to the controller in Spring MVC

I am developing an app where LoginForm.jsp and UserRegistration.jsp will lead to UserAccount jsp page on specific action.In LoginForm when a user presses a 'Login' button ->UserAccount form is displayed.In UserRegistration Form when details are entered and submitted ->UserAccount form is displayed. Below is the controller code when a request comes as UserAccount.html



@RequestMapping(value="/UserAccount.html", method = RequestMethod.POST)
public ModelAndView userAccountForm(@Valid @ModelAttribute("user") UserDetails user,BindingResult result) {

if(result.hasErrors())

{ System.out.println(result.getAllErrors());
ModelAndView model1=new ModelAndView("UserRegistration");
return model1;
}
// User validation


System.out.println(user.getAccountType());
userDAO.create(user);

ModelAndView model1 = new ModelAndView("UserAccount");
return model1;


}


Now for me I need to know the jsp page from which the UserAccount invoked ,to perform different actions based on that. I am new to Spring MVC and searched all over the internet for the solution.


Aucun commentaire:

Enregistrer un commentaire