You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Gu...@tietoenator.com on 2007/05/07 12:52:40 UTC
Is it possible to unit test validatiors in xml?
Hi,
Is it possible to unit test validations created in xml? I.e. like this:
<validators>
<!-- Plain Validator Syntax -->
<validator type="stringlength">
<param name="fieldName">myPurchaseCode</param>
<param name="minLength">10</param>
<param name="maxLength">10</param>
<param name="trim">true</param>
<message>Your purchase code needs to be 10 characters
long</message>
</validator>
<!-- Field Validator Syntax -->
<field name="myPurchaseCode">
<param name="minLength">10</param>
<param name="maxLength>10</param>
<param name="trim">true</param>
<message>Your purchase code needs to be 10 characters
long</message>
</field-name>
</validators>
Regards
Gunnar
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Is it possible to unit test validatiors in xml?
Posted by Gunnar Boström <Gu...@tietoenator.com>.
Hi,
Thanks I can now unit test my xml validation files but with one problem. My
action class implements ModelDriven so I need to add "model." before all
ognl-expression and remove it again after the tests!
Is there any solutions to that?
Regards
Gunnar
Martin Gilday wrote:
>
> http://wiki.opensymphony.com/display/WW/Testing+Validation describes how
> to do it for WebWork. The process should be very similar for Struts 2.
>
> Thanks,
> Martin.
>
>
> ----- Original message -----
> From: Gunnar.Bostrom@tietoenator.com
> To: user@struts.apache.org
> Date: Mon, 7 May 2007 12:52:40 +0200
> Subject: Is it possible to unit test validatiors in xml?
>
> Hi,
>
> Is it possible to unit test validations created in xml? I.e. like this:
>
> <validators>
> <!-- Plain Validator Syntax -->
> <validator type="stringlength">
> <param name="fieldName">myPurchaseCode</param>
> <param name="minLength">10</param>
> <param name="maxLength">10</param>
> <param name="trim">true</param>
> <message>Your purchase code needs to be 10 characters
> long</message>
> </validator>
> <!-- Field Validator Syntax -->
> <field name="myPurchaseCode">
> <param name="minLength">10</param>
> <param name="maxLength>10</param>
> <param name="trim">true</param>
> <message>Your purchase code needs to be 10 characters
> long</message>
> </field-name>
> </validators>
>
> Regards
> Gunnar
>
>
>
> ---------------------------------------------------------------------
> 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
>
>
>
--
View this message in context: http://www.nabble.com/Is-it-possible-to-unit-test-validatiors-in-xml--tf3703030.html#a10393478
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Is it possible to unit test validatiors in xml?
Posted by Martin Gilday <ma...@imap.cc>.
http://wiki.opensymphony.com/display/WW/Testing+Validation describes how
to do it for WebWork. The process should be very similar for Struts 2.
Thanks,
Martin.
----- Original message -----
From: Gunnar.Bostrom@tietoenator.com
To: user@struts.apache.org
Date: Mon, 7 May 2007 12:52:40 +0200
Subject: Is it possible to unit test validatiors in xml?
Hi,
Is it possible to unit test validations created in xml? I.e. like this:
<validators>
<!-- Plain Validator Syntax -->
<validator type="stringlength">
<param name="fieldName">myPurchaseCode</param>
<param name="minLength">10</param>
<param name="maxLength">10</param>
<param name="trim">true</param>
<message>Your purchase code needs to be 10 characters
long</message>
</validator>
<!-- Field Validator Syntax -->
<field name="myPurchaseCode">
<param name="minLength">10</param>
<param name="maxLength>10</param>
<param name="trim">true</param>
<message>Your purchase code needs to be 10 characters
long</message>
</field-name>
</validators>
Regards
Gunnar
---------------------------------------------------------------------
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: Problems with number convertion on s:input
Posted by André Faria <an...@mandic.com.br>.
I resolved that from this way:
<s:textfield name="cliente.salario" label="Salário"
value="%{getText('format.number',{cliente.salario})}"/><br/>
Thank's
André Faria
André Faria escreveu:
> The problem occurs from the action to view.....
> from the view to action its ok....
>
> Please I anyone can help...
>
> Thank's a lot
>
> André Faria escreveu:
>> Hi All,
>>
>> I have the follow problem:
>> I am using the Portuguese Brazil Localization on Struts 2, so the
>> format to decimal numbers is (1.000.000,00) equals (1,000,000.00) in
>> american localization.
>> If you fill the s:input fields with the brazilian format, the
>> struts converts the numbers in the correct way to a double number,
>> but when the struts reads the double field, it apparently only makes
>> an toString call, and it prints an unformated output. What can I do
>> to solve this problem?
>>
>> Have a nice day!
>>
>> Thank's,
>> André Faria
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problems with number convertion on s:input
Posted by André Faria <an...@mandic.com.br>.
The problem occurs from the action to view.....
from the view to action its ok....
Please I anyone can help...
Thank's a lot
André Faria escreveu:
> Hi All,
>
> I have the follow problem:
> I am using the Portuguese Brazil Localization on Struts 2, so the
> format to decimal numbers is (1.000.000,00) equals (1,000,000.00) in
> american localization.
> If you fill the s:input fields with the brazilian format, the
> struts converts the numbers in the correct way to a double number,
> but when the struts reads the double field, it apparently only makes
> an toString call, and it prints an unformated output. What can I do to
> solve this problem?
>
> Have a nice day!
>
> Thank's,
> André Faria
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Problems with number convertion on s:input
Posted by André Faria <an...@mandic.com.br>.
Hi All,
I have the follow problem:
I am using the Portuguese Brazil Localization on Struts 2, so the
format to decimal numbers is (1.000.000,00) equals (1,000,000.00) in
american localization.
If you fill the s:input fields with the brazilian format, the struts
converts the numbers in the correct way to a double number, but when
the struts reads the double field, it apparently only makes an toString
call, and it prints an unformated output. What can I do to solve this
problem?
Have a nice day!
Thank's,
André Faria
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org