相关疑难解决方法(0)

如何在Spring MVC simpleformcontroller上添加错误?

我的Spring MVC 2.5应用程序中存在这个问题,我不知道该怎么做.

这是我的代码:

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 …
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

spring ×1

spring-mvc ×1