you just have to write the validate method
public void validate ()
{
if (getModel().something()==null)
addFieldError("question", "Something went wrong");
}
On Thu, Jun 11, 2009 at 7:15 PM, Steven Hansen <[email protected]> wrote:
>
> Hi,
>
> I'm trying to test some basic validations on an action:
>
>
> public class CreateUserAction extends ActionSupport implements
> ModelDriven<User> {
> private User user = new User();
> private IUserDao userService = new UserDao();
> public String execute() {
> if ( this.userService.save(this.user) ) {
> return SUCCESS;
> }
> else {
> return INPUT;
> }
> }
> @VisitorFieldValidator(message="", shortCircuit = false, appendPrefix =
> false)
> public User getModel() {
> return this.user;
> }
> public void setModel(User user) {
> this.user = user;
> }
> }
>
>
> Is there anyway to manually check possible validation errors on this action
> as if it were called by the Validation interceptor?
>
> Thanks,
> Steven
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>