As you can define several action methods you also may need several validation methods.
But maybe it just adds more confusion to the validation workflow... and it's easy to call validateCreate() on your own. Another thing is that the validation in the action is often such things as it would require duplicate code in the validation and action method, not good.
So... +-0 from me :-)
Francisco Hernandez wrote:
what do you guys think of adding somekind of way to specify what the validation method to use in the validation interceptor?
right now it just uses validate() and is called on every action, but sometimes not all actions use that same validate method, so what i'd like to do is convert a action method like so:
public String create() { // check for errors and add them in they exist
if (!hasErrors()) { baseService.save(user); } else { return INPUT; } return SUCCESS; } to: public void validateCreate() { // check for errors and add them in they exist }
public String create() { baseService.save(user); return SUCCESS; }
benefit is that i dont need to check for errors in my methods, the validation interceptor will just send me back to INPUT if errors are in the action.
any input?
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork