My index page contains a visible login form and a hidden registration form (the two toggle visibility). When a user registers and has some validation errors, they return to the index page. However, by default, they will see the login page. How could the controller tell the index page to run some javascript code (just to hide login and display registration)?
@RequestMapping(value="/register", method=RequestMethod.POST)
public String addNewUser(@Valid @ModelAttribute("registerForm") RegisterForm registerForm,
BindingResult result, Model model, HttpServletRequest request){
if(result.hasErrors()){
model.addAttribute("error", true);
System.out.println("ERROR");
return "index";
}
return "index";
}
indexpage, what kind of view technology are you using (e.g. jsp, velocity, thymeleaf, ...)