跟simpleform controller一樣,先在xml中設定好validator 只要validator的support有支援到在multiaction controller中的command的時候 就會採用該valiodator 接下來新增一個MyMultiacitonController 擴展原本的multiaction controller public class MyMultiactionController extends MultiActionController { //用來儲存binding error的model private Map errorModel = null; //以下是修改原始程式碼的結果 @Override protected void bind(HttpServletRequest request, Object command) throws Exception { logger.debug("Binding request parameters onto MultiActionController command"); ServletRequestDataBinder binder = createBinder(request, command); binder.bind(request); if (getValidators() != null) { for (int i = 0; i if (getValidators()[i].supports(command.getClass())) { ValidationUtils.invokeValidator(getValidators()[i], command, binder.getBindingResult()); } } } if (binder.getBindingResult().hasErrors()) { setErrorModel(binder.getBindingResult().getModel()); } } public Map getErrorModel() { Map map = this.errorModel; this.errorModel = n...