You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thomas Thomas <de...@gmail.com> on 2006/12/08 23:09:19 UTC

Validator - Date validation

Hi,
I see that I can validate a Date with the Validator framework,
but don't know how to apply it in my case.

my bean has separate variables for day - month - year
(it is not one string)
I have three fields because he had to choose the date with a select html tag
for the day, a select html tag for the month and an input field for the
year.

How can I validate this date now ?

Thank u !

Re: Validator - Date validation

Posted by Thomas Thomas <de...@gmail.com>.
Ok everything is fixed, I forgot to do :

ValidatorUtils.getValueAsString

Re: Validator - Date validation

Posted by Thomas Thomas <de...@gmail.com>.
I get the String literals and not the real numbers

Re: Validator - Date validation

Posted by Thomas Thomas <de...@gmail.com>.
I make a custom validator myDate
I try to give as var value the day and the month,
but when I try to get the values of the vars day and month,
I get the String literals birthDay and birthMonth

            <field property="birthDay"></field>

            <field property="birthMonth"></field>

            <field property="birthYear" depends="myDate">
                <arg name ="date" key="invalid.date"/>
                <var>
                      <var-name>day</var-name>
                      <var-value>birthDay</var-value>
                </var>
                <var>
                      <var-name>month</var-name>
                      <var-value>birthMonth</var-value>
                </var>
            </field>

Re: [s2]

Posted by Eric Rank <er...@lo-fi.net>.
Excellent! Thanks Don!

E.


On Dec 8, 2006, at 5:56 PM, Don Brown wrote:

> The '%' tells Struts to parse it with OGNL.  OGNL is a very powerful
> expression language used by the core of Struts 2.  It supports
> advanced features like method calls, projection, and data conversion.
> You can find more information about ognl here:
> http://www.opensymphony.com/ognl/
>
> Don
>
> On 12/8/06, Eric Rank <er...@lo-fi.net> wrote:
>> I've noticed that there's an EL-like syntax used within some tags in
>> the sample jsp's that ship with the Struts 2 apps. Namely:
>>
>> <s:a href="%{url}">
>>
>> How does the percent sign work in the line above? When I use ${url}
>> it works just as well.
>>
>> Am I just behind on Expression Language specs? or is this a
>> convention that I'm unaware of in the new Struts 2 tags?
>>
>> Thanks for getting me up to speed!
>>
>> Eric Rank
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [s2]

Posted by Don Brown <do...@gmail.com>.
The '%' tells Struts to parse it with OGNL.  OGNL is a very powerful
expression language used by the core of Struts 2.  It supports
advanced features like method calls, projection, and data conversion.
You can find more information about ognl here:
http://www.opensymphony.com/ognl/

Don

On 12/8/06, Eric Rank <er...@lo-fi.net> wrote:
> I've noticed that there's an EL-like syntax used within some tags in
> the sample jsp's that ship with the Struts 2 apps. Namely:
>
> <s:a href="%{url}">
>
> How does the percent sign work in the line above? When I use ${url}
> it works just as well.
>
> Am I just behind on Expression Language specs? or is this a
> convention that I'm unaware of in the new Struts 2 tags?
>
> Thanks for getting me up to speed!
>
> Eric Rank
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


[s2]

Posted by Eric Rank <er...@lo-fi.net>.
I've noticed that there's an EL-like syntax used within some tags in  
the sample jsp's that ship with the Struts 2 apps. Namely:

<s:a href="%{url}">

How does the percent sign work in the line above? When I use ${url}  
it works just as well.

Am I just behind on Expression Language specs? or is this a  
convention that I'm unaware of in the new Struts 2 tags?

Thanks for getting me up to speed!

Eric Rank

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org