Hi all,

Most probably I'm writing you a repetitive topic: how to adjust validations at 
runtime.

I have a jsp in which users enter their birth date, for the year filed I have:

            <p class="fieldlabel">
            ${birthyearLabel}:<br/>
            <stripes:text name="birthyear" size="4" maxlength="4" 
class="inputtext"/>
            </p>

The validation in the bean is:

    @Validate(required = true, minvalue = 1900, maxvalue = 2010)
    private int birthyear;

I need to have the year validation adjusted to the current year, something like:
    @Validate(required = true, minvalue = 1900, maxvalue =  
Calendar.getInstance().get(Calendar.YEAR) ) 
    private int birthyear;
The snippet above does not work, and seems like nothing can be done with 
annotations since they only accept values at compile time.

So, I was looking for another option to define the validation range at runtime, 
or at least at startup of the webapp, something like a validation file 
descriptor that could override the annotation. I found nothing about it.

Using a javascript is not a good option either, IMO it just does not naturally 
integrates with Stripes.

Please advice. Thanks.


                                          
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to