In Struts2 you can change the method used for execution for an action by changing the method attribute in the following l开发者_开发技巧ine:
<action name="registerVal" class="cz.vutbr.fit.pishotel.model.action.Register" method="execute">
Is it possible to change the validation method used as well, or is the validate method name hardcoded.
It hard coded in the following way. If you have:
<action name="registerVal" class="cz.vutbr.fit.pishotel.model.action.Register" method="myMethod">
Then the validation interceptor will call
public void validateMyMethod() {
if (someValue == null) {
addFieldError("myField","myMessage");
}
}
If there are errors in the fieldErrors collection then INPUT will be returned for registerVal
精彩评论