Hi All,
I have this problem in my spring mvc 2.5 apps and I am not sure what should I do.
Kindly look at my code:
public class AddStationController extends SimpleFormController {
private SimpleStationManager stationManager;
protected ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
StationDetails detail = (StationDetails) command;
//add to DB
int return = stationManager.addStation(detail);
//return value: 1 = successful,
// if not = unsuccessful
if(return != 1){
//how can I add error so that when I display my formview ,
//I could notify the user that saving to the db is not successful?
showform();
}
return new ModelAndView("redirect:" + getSuccessView());
}
}
How is it possible to add some message when I display my formview again so that I could tell the user that adding the station was not successful?
And how to handle that in my jsp?
Hope somebody can help me please..