I have two pages, the first has a form with hidden fields which send parameters to the second one. I want to return an error message if the user go to the second page while the form with hidden fields is empty, so for doing that i tried that but it's not working:
@RequestMapping(value="/generate",method=RequestMethod.POST)
public String FicheService(@ModelAttribute Movement movement,@RequestParam("nom") String nom, @RequestParam("number") Integer number,ModelMap model){
if(nom=="" && number == null) { model.addAttribute("errorMessage",true);
return "firstPage";
}
else { return "secondPage";}
}
How to check if @RequestParam is empty or not?