It depends on the situtation, but I usually try to avoid using on="event" on
the @Validates and instead just turn off validation using @DontValidate or
@DontBind on the event handlers where I don't need validation. E.g.,

@DontBind public Resolution get() { ... }

But to answer your question, there is no way to specify on="event" once for
multiple @Validates.

-Ben

On Fri, Dec 12, 2008 at 12:28 AM, Simon <[email protected]> wrote:

> Hello all,
>
> Just a quick question about something that seems dirty and I wish I
> could do better - I have an action bean like so:
>
>  public class StatusAction extends ... BaseActionBean {
>      ....
>      @ValidateNestedProperties({
>          @Validate(field="key",required=true,on="put"),
>          @Validate(field="accountId",required=true,on="put"),
>          @Validate(field="status",required=true,on="put"),
>          @Validate(field="progress",required=true,minvalue=0.0,
> maxvalue=1.0,on="put")
>      })
>      Status status;
>
>      public Resolution put() {
>          ...
>      }
>      public Resolution get() {
>          ...
>      }
>  }
>
> Notice I only want the validation to run on the "put" event.  However
> I had to repeat that declaration (on="put") 4 times, once for each
> @Validate inside the nested properties.  Is there any way to avoid
> that repetition and just say that the whole "status" object is only to
> be validated for a "put" and not for a "get"?
>
> Cheers & thanks for any advice!
>
> Simon.
>
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to