You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by gaurav nigam <ma...@gmail.com> on 2009/11/07 18:14:32 UTC

query regarding Input Validation

Hi All,

I have a query regarding input validation.

# Can we use method wise input validation in struts 2 ?
if this is not supported directly, then is there any workaround for the same.

#To utilise the xml based validation, I have to create different
action class for same module...like module is "user" and i had to
create different action classes like adduser.action, modifyuser.action
class etc...i have to do this as there are some fields which are
different in each action....ideally i want to have single action class
with different methods like add, modify, etc... to handle this..but
can not do it so as same set of validation will be called for each
method...which is not required in my case...

After some search and study, i came to know that there is annotation
validation which can be used and will be invoked per method...as
mentioned in this link
http://struts.apache.org/2.0.14/docs/validations-annotation.html

but here, in need to hard code, my messages which i really want to
avoid it, Is there any way to use property file here...please provide
suggestion on this.....

I have also learned that this annotation validation will not work for
client side validation. Is there any work around for this....


Kindly help me in this regard


Thanks

Gaurav

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


Re: query regarding Input Validation

Posted by Dave Newton <ne...@yahoo.com>.
gaurav nigam wrote:
> Do I need to add this interceptor for each action mapping....?
> Is it possible to have only single entry of this interceptor in the struts.xml ?

Make your own default interceptor stack, but it's already in the 
"defaultStack".

Dave


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


Re: query regarding Input Validation

Posted by gaurav nigam <ma...@gmail.com>.
Thanks for your reply Martin....

Few more Queries.....

Do I need to add this interceptor for each action mapping....?
Is it possible to have only single entry of this interceptor in the struts.xml ?



Thanks & Regards

Gaurav

On Sun, Nov 8, 2009 at 1:56 AM, Martin Gainty <mg...@hotmail.com> wrote:
>
> this comes from http://struts.apache.org/2.1.8/docs/i18n-interceptor.html
>
>
> For example, using the default parameter name, a request to foo.action?request_locale=en_US, then the
> locale for US English is saved in the user's session and will be used for all future requests.
>
>
>
> Parameters
>
>
> parameterName (optional) - the name of the HTTP request parameter that dictates the locale to switch to and save
> in the session. By default this is request_localeattributeName (optional) - the name of the session key to store the selected locale. By default this is
> WW_TRANS_I18N_LOCALE
>
>
> Extending the Interceptor
>
>
> There are no known extensions points for this interceptor.
>
>
>
> Examples
>
>
> <action name="someAction" class="com.examples.SomeAction">
>    <interceptor-ref name="i18n"/>
>    <interceptor-ref name="basicStack"/>
>    <result name="success">good_result.ftl</result>
> </action>
> ### This can be used to set your default locale and encoding scheme in default.properties
> # struts.locale=en_US
> struts.i18n.encoding=UTF-8
>
> hth
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
>
>
>
>
>> Date: Sat, 7 Nov 2009 21:41:27 +0000
>> Subject: Re: query regarding Input Validation
>> From: mailgauravat@gmail.com
>> To: user@struts.apache.org
>>
>> Thanks for the reply.....
>> getText() method can be useful but only to some extent only as there
>> is no way to provide parameterized  value of locale to getText()
>> method.
>>
>> I can create the new instance of resource bundle with locale as
>> parameter but that would not be a nice workaround...
>>
>> I am expecting there will be some way within the struts 2 existing
>> methods which can be used in such scenario.....
>>
>> I looking for solution with the expectation to support i18n functionality.
>>
>>
>> Regards
>>
>> Gaurav
>>
>> On Sat, Nov 7, 2009 at 7:13 PM, Siddiq Syed <si...@yahoo.com> wrote:
>> > I never try this , but you can get messages from applicationResource.propeties file by doing
>> > getText("")
>> >
>> > http://struts.apache.org/2.0.6/struts2-core/apidocs/com/opensymphony/xwork2/TextProvider.html
>> >
>> > But I am not sure if this is going to work for annotations.
>> >  Regards,
>> > Siddiq
>> > 919-924-9850
>> >
>> >
>> >
>> >
>> > ________________________________
>> > From: gaurav nigam <ma...@gmail.com>
>> > To: Struts Users Mailing List <us...@struts.apache.org>
>> > Sent: Sat, November 7, 2009 2:03:41 PM
>> > Subject: Re: query regarding Input Validation
>> >
>> > Hi Siddiq,
>> >
>> > My Question 2 is mentioned below
>> >
>> > i came to know that there is annotation  validation which can be used
>> > and will be invoked per method...as mentioned in this link
>> > http://struts.apache.org/2.0.14/docs/validations-annotation.html
>> >
>> > but here, in need to hard code, my messages which i really want to
>> > avoid it,
>> > "Is there any way to use property file here..."
>> > please provide suggestion on this.....
>> >
>> > I have also learned that this annotation validation will not work for
>> > client side validation. Is there any work around for this....
>> >
>> >
>> > Regards
>> >
>> > Gaurav
>> >
>> > On Sat, Nov 7, 2009 at 6:54 PM, Siddiq Syed <si...@yahoo.com> wrote:
>> >>
>> >> Please refer the section
>> >>
>> >> Defining Validation Rules in the below mention link.
>> >>
>> >> http://docs.huihoo.com/webwork/2.2.6/Validation.html
>> >>
>> >> -siddiq.
>> >>
>> >>
>> >> Siddiq Syed wrote:
>> >>>
>> >>>
>> >>> From: gaurav nigam <ma...@gmail.com>
>> >>> To: Struts Users Mailing List <us...@struts.apache.org>
>> >>> Sent: Sat, November 7, 2009 1:21:41 PM
>> >>> Subject: Re: query regarding Input Validation
>> >>>
>> >>> Hi Saddiq,
>> >>> -- siddiq
>> >>>
>> >>> Thanks for your help....
>> >>> I am not able to understand meaning of below line
>> >>> You can achive this by creating an separate file for each method
>> >>> ...do you mean that i should create separate action class for each method
>> >>> or you mean to say separate validation file for each method of an
>> >>> action class...
>> >>>
>> >>> --- Separate validation file for each action name speicifed in the
>> >>> struts.xml ,
>> >>> http://docs.huihoo.com/webwork/2.2.6/Validation.html
>> >>>
>> >>>
>> >>>
>> >>> By your suggestion, I need to create multiple action mappings in
>> >>> struts.xml for each of the method of the action class....
>> >>>
>> >>> Its not with the method of the actin class , its the action name what is
>> >>> been defined in the strust.xlml
>> >>> -- For example if you have an action class user
>> >>> UserAction.java
>> >>> public class UserAction extends action {
>> >>>      public String addUser(){
>> >>>         return success;
>> >>>     }
>> >>>     public String modifyUser(){
>> >>>         return success;
>> >>>     }
>> >>> }
>> >>>
>> >>> struts.xml
>> >>> <action name="addUser"  class="UserAction" method="addUser">
>> >>>     <result name="success'>somejsp.jsp</result>
>> >>>     <result name="input">otherjsp.jsp</result>
>> >>> </action>
>> >>>
>> >>> <action name="modifyUser"  class="UserAction" method="modifyUser">
>> >>>     <result name="success'>somejsp.jsp</result>
>> >>>     <result name="input">otherjsp.jsp</result>
>> >>> </action>
>> >>>
>> >>> Validation files naming convection .
>> >>>
>> >>> UserAction-addUser-validation.xml -- when user click on adduser --this
>> >>> validation file is going to be invoked
>> >>> UserAction-modifyUser-validation.xml -- when user click on modifyuser --
>> >>> this validation file is going to be invoked.
>> >>>
>> >>> http://docs.huihoo.com/webwork/2.2.6/Validation.html
>> >>>
>> >>> Note : this validation files need to be in the same package with action
>> >>> class.
>> >>>
>> >>> Can we avoid this multiple action mappings by wildcard characters.....?
>> >>>
>> >>> -- Yes we can avoid multiple action mapping.
>> >>>
>> >>>
>> >>> Please suggest your opinion.....
>> >>>
>> >>> I am also waiting for some reply on Question 2 I have asked on earlier
>> >>> mail....
>> >>>  Question 2 ?
>> >>>
>> >>> Thanks
>> >>>
>> >>> Gaurav
>> >>>
>> >>> On Sat, Nov 7, 2009 at 6:02 PM, Siddiq Syed <si...@yahoo.com> wrote:
>> >>>> You can achive this by creating an seprate file for each method and add
>> >>>> the validation.
>> >>>> When ever the a method from the action class is invoked the corresponding
>> >>>> validation will get invoked.
>> >>>>
>> >>>> actionname-aliasname-validationname.xml
>> >>>>
>> >>>> actinname -- name of your actin class.
>> >>>> aliasname -- name of the action specifed in the strust-xml file.
>> >>>>
>> >>>> <action name="x" class="com.yaction" method="x">
>> >>>>      <result name="input" type="tiles">validationresult.jsp</result>
>> >>>> </action>
>> >>>>
>> >>>> name of the validation file for the above mention action will be
>> >>>>
>> >>>> yaction-x-validation.xml -- where you can define the validation and will
>> >>>> be invoke when action x is invoked.
>> >>>>
>> >>>>
>> >>>>  -Siddiq.
>> >>>>
>> >>>>
>> >>>>
>> >>>> ________________________________
>> >>>> From: gaurav nigam <ma...@gmail.com>
>> >>>> To: Struts Users Mailing List <us...@struts.apache.org>
>> >>>> Sent: Sat, November 7, 2009 12:14:32 PM
>> >>>> Subject: query regarding Input Validation
>> >>>>
>> >>>> Hi All,
>> >>>>
>> >>>> I have a query regarding input validation.
>> >>>>
>> >>>> # Can we use method wise input validation in struts 2 ?
>> >>>> if this is not supported directly, then is there any workaround for the
>> >>>> same.
>> >>>>
>> >>>> #To utilise the xml based validation, I have to create different
>> >>>> action class for same module...like module is "user" and i had to
>> >>>> create different action classes like adduser.action, modifyuser.action
>> >>>> class etc...i have to do this as there are some fields which are
>> >>>> different in each action....ideally i want to have single action class
>> >>>> with different methods like add, modify, etc... to handle this..but
>> >>>> can not do it so as same set of validation will be called for each
>> >>>> method...which is not required in my case...
>> >>>>
>> >>>> After some search and study, i came to know that there is annotation
>> >>>> validation which can be used and will be invoked per method...as
>> >>>> mentioned in this link
>> >>>> http://struts.apache.org/2.0.14/docs/validations-annotation.html
>> >>>>
>> >>>> but here, in need to hard code, my messages which i really want to
>> >>>> avoid it, Is there any way to use property file here...please provide
>> >>>> suggestion on this.....
>> >>>>
>> >>>> I have also learned that this annotation validation will not work for
>> >>>> client side validation. Is there any work around for this....
>> >>>>
>> >>>>
>> >>>> Kindly help me in this regard
>> >>>>
>> >>>>
>> >>>> Thanks
>> >>>>
>> >>>> Gaurav
>> >>>>
>> >>>> ---------------------------------------------------------------------
>> >>>> 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://old.nabble.com/query-regarding-Input-Validation-tp26246719p26247537.html
>> >> 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
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > 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
>>
>
> _________________________________________________________________
> Hotmail: Trusted email with Microsoft's powerful SPAM protection.
> http://clk.atdmt.com/GBL/go/177141664/direct/01/
> http://clk.atdmt.com/GBL/go/177141664/direct/01/
>

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


RE: query regarding Input Validation

Posted by Martin Gainty <mg...@hotmail.com>.
this comes from http://struts.apache.org/2.1.8/docs/i18n-interceptor.html


For example, using the default parameter name, a request to foo.action?request_locale=en_US, then the
locale for US English is saved in the user's session and will be used for all future requests.



Parameters


parameterName (optional) - the name of the HTTP request parameter that dictates the locale to switch to and save
in the session. By default this is request_localeattributeName (optional) - the name of the session key to store the selected locale. By default this is
WW_TRANS_I18N_LOCALE


Extending the Interceptor


There are no known extensions points for this interceptor.



Examples


<action name="someAction" class="com.examples.SomeAction">
    <interceptor-ref name="i18n"/>
    <interceptor-ref name="basicStack"/>
    <result name="success">good_result.ftl</result>
</action>
### This can be used to set your default locale and encoding scheme in default.properties
# struts.locale=en_US
struts.i18n.encoding=UTF-8

hth
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Sat, 7 Nov 2009 21:41:27 +0000
> Subject: Re: query regarding Input Validation
> From: mailgauravat@gmail.com
> To: user@struts.apache.org
> 
> Thanks for the reply.....
> getText() method can be useful but only to some extent only as there
> is no way to provide parameterized  value of locale to getText()
> method.
> 
> I can create the new instance of resource bundle with locale as
> parameter but that would not be a nice workaround...
> 
> I am expecting there will be some way within the struts 2 existing
> methods which can be used in such scenario.....
> 
> I looking for solution with the expectation to support i18n functionality.
> 
> 
> Regards
> 
> Gaurav
> 
> On Sat, Nov 7, 2009 at 7:13 PM, Siddiq Syed <si...@yahoo.com> wrote:
> > I never try this , but you can get messages from applicationResource.propeties file by doing
> > getText("")
> >
> > http://struts.apache.org/2.0.6/struts2-core/apidocs/com/opensymphony/xwork2/TextProvider.html
> >
> > But I am not sure if this is going to work for annotations.
> >  Regards,
> > Siddiq
> > 919-924-9850
> >
> >
> >
> >
> > ________________________________
> > From: gaurav nigam <ma...@gmail.com>
> > To: Struts Users Mailing List <us...@struts.apache.org>
> > Sent: Sat, November 7, 2009 2:03:41 PM
> > Subject: Re: query regarding Input Validation
> >
> > Hi Siddiq,
> >
> > My Question 2 is mentioned below
> >
> > i came to know that there is annotation  validation which can be used
> > and will be invoked per method...as mentioned in this link
> > http://struts.apache.org/2.0.14/docs/validations-annotation.html
> >
> > but here, in need to hard code, my messages which i really want to
> > avoid it,
> > "Is there any way to use property file here..."
> > please provide suggestion on this.....
> >
> > I have also learned that this annotation validation will not work for
> > client side validation. Is there any work around for this....
> >
> >
> > Regards
> >
> > Gaurav
> >
> > On Sat, Nov 7, 2009 at 6:54 PM, Siddiq Syed <si...@yahoo.com> wrote:
> >>
> >> Please refer the section
> >>
> >> Defining Validation Rules in the below mention link.
> >>
> >> http://docs.huihoo.com/webwork/2.2.6/Validation.html
> >>
> >> -siddiq.
> >>
> >>
> >> Siddiq Syed wrote:
> >>>
> >>>
> >>> From: gaurav nigam <ma...@gmail.com>
> >>> To: Struts Users Mailing List <us...@struts.apache.org>
> >>> Sent: Sat, November 7, 2009 1:21:41 PM
> >>> Subject: Re: query regarding Input Validation
> >>>
> >>> Hi Saddiq,
> >>> -- siddiq
> >>>
> >>> Thanks for your help....
> >>> I am not able to understand meaning of below line
> >>> You can achive this by creating an separate file for each method
> >>> ...do you mean that i should create separate action class for each method
> >>> or you mean to say separate validation file for each method of an
> >>> action class...
> >>>
> >>> --- Separate validation file for each action name speicifed in the
> >>> struts.xml ,
> >>> http://docs.huihoo.com/webwork/2.2.6/Validation.html
> >>>
> >>>
> >>>
> >>> By your suggestion, I need to create multiple action mappings in
> >>> struts.xml for each of the method of the action class....
> >>>
> >>> Its not with the method of the actin class , its the action name what is
> >>> been defined in the strust.xlml
> >>> -- For example if you have an action class user
> >>> UserAction.java
> >>> public class UserAction extends action {
> >>>      public String addUser(){
> >>>         return success;
> >>>     }
> >>>     public String modifyUser(){
> >>>         return success;
> >>>     }
> >>> }
> >>>
> >>> struts.xml
> >>> <action name="addUser"  class="UserAction" method="addUser">
> >>>     <result name="success'>somejsp.jsp</result>
> >>>     <result name="input">otherjsp.jsp</result>
> >>> </action>
> >>>
> >>> <action name="modifyUser"  class="UserAction" method="modifyUser">
> >>>     <result name="success'>somejsp.jsp</result>
> >>>     <result name="input">otherjsp.jsp</result>
> >>> </action>
> >>>
> >>> Validation files naming convection .
> >>>
> >>> UserAction-addUser-validation.xml -- when user click on adduser --this
> >>> validation file is going to be invoked
> >>> UserAction-modifyUser-validation.xml -- when user click on modifyuser --
> >>> this validation file is going to be invoked.
> >>>
> >>> http://docs.huihoo.com/webwork/2.2.6/Validation.html
> >>>
> >>> Note : this validation files need to be in the same package with action
> >>> class.
> >>>
> >>> Can we avoid this multiple action mappings by wildcard characters.....?
> >>>
> >>> -- Yes we can avoid multiple action mapping.
> >>>
> >>>
> >>> Please suggest your opinion.....
> >>>
> >>> I am also waiting for some reply on Question 2 I have asked on earlier
> >>> mail....
> >>>  Question 2 ?
> >>>
> >>> Thanks
> >>>
> >>> Gaurav
> >>>
> >>> On Sat, Nov 7, 2009 at 6:02 PM, Siddiq Syed <si...@yahoo.com> wrote:
> >>>> You can achive this by creating an seprate file for each method and add
> >>>> the validation.
> >>>> When ever the a method from the action class is invoked the corresponding
> >>>> validation will get invoked.
> >>>>
> >>>> actionname-aliasname-validationname.xml
> >>>>
> >>>> actinname -- name of your actin class.
> >>>> aliasname -- name of the action specifed in the strust-xml file.
> >>>>
> >>>> <action name="x" class="com.yaction" method="x">
> >>>>      <result name="input" type="tiles">validationresult.jsp</result>
> >>>> </action>
> >>>>
> >>>> name of the validation file for the above mention action will be
> >>>>
> >>>> yaction-x-validation.xml -- where you can define the validation and will
> >>>> be invoke when action x is invoked.
> >>>>
> >>>>
> >>>>  -Siddiq.
> >>>>
> >>>>
> >>>>
> >>>> ________________________________
> >>>> From: gaurav nigam <ma...@gmail.com>
> >>>> To: Struts Users Mailing List <us...@struts.apache.org>
> >>>> Sent: Sat, November 7, 2009 12:14:32 PM
> >>>> Subject: query regarding Input Validation
> >>>>
> >>>> Hi All,
> >>>>
> >>>> I have a query regarding input validation.
> >>>>
> >>>> # Can we use method wise input validation in struts 2 ?
> >>>> if this is not supported directly, then is there any workaround for the
> >>>> same.
> >>>>
> >>>> #To utilise the xml based validation, I have to create different
> >>>> action class for same module...like module is "user" and i had to
> >>>> create different action classes like adduser.action, modifyuser.action
> >>>> class etc...i have to do this as there are some fields which are
> >>>> different in each action....ideally i want to have single action class
> >>>> with different methods like add, modify, etc... to handle this..but
> >>>> can not do it so as same set of validation will be called for each
> >>>> method...which is not required in my case...
> >>>>
> >>>> After some search and study, i came to know that there is annotation
> >>>> validation which can be used and will be invoked per method...as
> >>>> mentioned in this link
> >>>> http://struts.apache.org/2.0.14/docs/validations-annotation.html
> >>>>
> >>>> but here, in need to hard code, my messages which i really want to
> >>>> avoid it, Is there any way to use property file here...please provide
> >>>> suggestion on this.....
> >>>>
> >>>> I have also learned that this annotation validation will not work for
> >>>> client side validation. Is there any work around for this....
> >>>>
> >>>>
> >>>> Kindly help me in this regard
> >>>>
> >>>>
> >>>> Thanks
> >>>>
> >>>> Gaurav
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> 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://old.nabble.com/query-regarding-Input-Validation-tp26246719p26247537.html
> >> 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
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > 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
> 
 		 	   		  
_________________________________________________________________
Hotmail: Trusted email with Microsoft's powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141664/direct/01/
http://clk.atdmt.com/GBL/go/177141664/direct/01/

Re: query regarding Input Validation

Posted by gaurav nigam <ma...@gmail.com>.
Thanks for the reply.....
getText() method can be useful but only to some extent only as there
is no way to provide parameterized  value of locale to getText()
method.

I can create the new instance of resource bundle with locale as
parameter but that would not be a nice workaround...

I am expecting there will be some way within the struts 2 existing
methods which can be used in such scenario.....

I looking for solution with the expectation to support i18n functionality.


Regards

Gaurav

On Sat, Nov 7, 2009 at 7:13 PM, Siddiq Syed <si...@yahoo.com> wrote:
> I never try this , but you can get messages from applicationResource.propeties file by doing
> getText("")
>
> http://struts.apache.org/2.0.6/struts2-core/apidocs/com/opensymphony/xwork2/TextProvider.html
>
> But I am not sure if this is going to work for annotations.
>  Regards,
> Siddiq
> 919-924-9850
>
>
>
>
> ________________________________
> From: gaurav nigam <ma...@gmail.com>
> To: Struts Users Mailing List <us...@struts.apache.org>
> Sent: Sat, November 7, 2009 2:03:41 PM
> Subject: Re: query regarding Input Validation
>
> Hi Siddiq,
>
> My Question 2 is mentioned below
>
> i came to know that there is annotation  validation which can be used
> and will be invoked per method...as mentioned in this link
> http://struts.apache.org/2.0.14/docs/validations-annotation.html
>
> but here, in need to hard code, my messages which i really want to
> avoid it,
> "Is there any way to use property file here..."
> please provide suggestion on this.....
>
> I have also learned that this annotation validation will not work for
> client side validation. Is there any work around for this....
>
>
> Regards
>
> Gaurav
>
> On Sat, Nov 7, 2009 at 6:54 PM, Siddiq Syed <si...@yahoo.com> wrote:
>>
>> Please refer the section
>>
>> Defining Validation Rules in the below mention link.
>>
>> http://docs.huihoo.com/webwork/2.2.6/Validation.html
>>
>> -siddiq.
>>
>>
>> Siddiq Syed wrote:
>>>
>>>
>>> From: gaurav nigam <ma...@gmail.com>
>>> To: Struts Users Mailing List <us...@struts.apache.org>
>>> Sent: Sat, November 7, 2009 1:21:41 PM
>>> Subject: Re: query regarding Input Validation
>>>
>>> Hi Saddiq,
>>> -- siddiq
>>>
>>> Thanks for your help....
>>> I am not able to understand meaning of below line
>>> You can achive this by creating an separate file for each method
>>> ...do you mean that i should create separate action class for each method
>>> or you mean to say separate validation file for each method of an
>>> action class...
>>>
>>> --- Separate validation file for each action name speicifed in the
>>> struts.xml ,
>>> http://docs.huihoo.com/webwork/2.2.6/Validation.html
>>>
>>>
>>>
>>> By your suggestion, I need to create multiple action mappings in
>>> struts.xml for each of the method of the action class....
>>>
>>> Its not with the method of the actin class , its the action name what is
>>> been defined in the strust.xlml
>>> -- For example if you have an action class user
>>> UserAction.java
>>> public class UserAction extends action {
>>>      public String addUser(){
>>>         return success;
>>>     }
>>>     public String modifyUser(){
>>>         return success;
>>>     }
>>> }
>>>
>>> struts.xml
>>> <action name="addUser"  class="UserAction" method="addUser">
>>>     <result name="success'>somejsp.jsp</result>
>>>     <result name="input">otherjsp.jsp</result>
>>> </action>
>>>
>>> <action name="modifyUser"  class="UserAction" method="modifyUser">
>>>     <result name="success'>somejsp.jsp</result>
>>>     <result name="input">otherjsp.jsp</result>
>>> </action>
>>>
>>> Validation files naming convection .
>>>
>>> UserAction-addUser-validation.xml -- when user click on adduser --this
>>> validation file is going to be invoked
>>> UserAction-modifyUser-validation.xml -- when user click on modifyuser --
>>> this validation file is going to be invoked.
>>>
>>> http://docs.huihoo.com/webwork/2.2.6/Validation.html
>>>
>>> Note : this validation files need to be in the same package with action
>>> class.
>>>
>>> Can we avoid this multiple action mappings by wildcard characters.....?
>>>
>>> -- Yes we can avoid multiple action mapping.
>>>
>>>
>>> Please suggest your opinion.....
>>>
>>> I am also waiting for some reply on Question 2 I have asked on earlier
>>> mail....
>>>  Question 2 ?
>>>
>>> Thanks
>>>
>>> Gaurav
>>>
>>> On Sat, Nov 7, 2009 at 6:02 PM, Siddiq Syed <si...@yahoo.com> wrote:
>>>> You can achive this by creating an seprate file for each method and add
>>>> the validation.
>>>> When ever the a method from the action class is invoked the corresponding
>>>> validation will get invoked.
>>>>
>>>> actionname-aliasname-validationname.xml
>>>>
>>>> actinname -- name of your actin class.
>>>> aliasname -- name of the action specifed in the strust-xml file.
>>>>
>>>> <action name="x" class="com.yaction" method="x">
>>>>      <result name="input" type="tiles">validationresult.jsp</result>
>>>> </action>
>>>>
>>>> name of the validation file for the above mention action will be
>>>>
>>>> yaction-x-validation.xml -- where you can define the validation and will
>>>> be invoke when action x is invoked.
>>>>
>>>>
>>>>  -Siddiq.
>>>>
>>>>
>>>>
>>>> ________________________________
>>>> From: gaurav nigam <ma...@gmail.com>
>>>> To: Struts Users Mailing List <us...@struts.apache.org>
>>>> Sent: Sat, November 7, 2009 12:14:32 PM
>>>> Subject: query regarding Input Validation
>>>>
>>>> Hi All,
>>>>
>>>> I have a query regarding input validation.
>>>>
>>>> # Can we use method wise input validation in struts 2 ?
>>>> if this is not supported directly, then is there any workaround for the
>>>> same.
>>>>
>>>> #To utilise the xml based validation, I have to create different
>>>> action class for same module...like module is "user" and i had to
>>>> create different action classes like adduser.action, modifyuser.action
>>>> class etc...i have to do this as there are some fields which are
>>>> different in each action....ideally i want to have single action class
>>>> with different methods like add, modify, etc... to handle this..but
>>>> can not do it so as same set of validation will be called for each
>>>> method...which is not required in my case...
>>>>
>>>> After some search and study, i came to know that there is annotation
>>>> validation which can be used and will be invoked per method...as
>>>> mentioned in this link
>>>> http://struts.apache.org/2.0.14/docs/validations-annotation.html
>>>>
>>>> but here, in need to hard code, my messages which i really want to
>>>> avoid it, Is there any way to use property file here...please provide
>>>> suggestion on this.....
>>>>
>>>> I have also learned that this annotation validation will not work for
>>>> client side validation. Is there any work around for this....
>>>>
>>>>
>>>> Kindly help me in this regard
>>>>
>>>>
>>>> Thanks
>>>>
>>>> Gaurav
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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://old.nabble.com/query-regarding-Input-Validation-tp26246719p26247537.html
>> 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
>>
>>
>
> ---------------------------------------------------------------------
> 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: query regarding Input Validation

Posted by Siddiq Syed <si...@yahoo.com>.
I never try this , but you can get messages from applicationResource.propeties file by doing 
getText("")

http://struts.apache.org/2.0.6/struts2-core/apidocs/com/opensymphony/xwork2/TextProvider.html

But I am not sure if this is going to work for annotations.
 Regards,
Siddiq
919-924-9850 




________________________________
From: gaurav nigam <ma...@gmail.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Sat, November 7, 2009 2:03:41 PM
Subject: Re: query regarding Input Validation

Hi Siddiq,

My Question 2 is mentioned below

i came to know that there is annotation  validation which can be used
and will be invoked per method...as mentioned in this link
http://struts.apache.org/2.0.14/docs/validations-annotation.html

but here, in need to hard code, my messages which i really want to
avoid it,
"Is there any way to use property file here..."
please provide suggestion on this.....

I have also learned that this annotation validation will not work for
client side validation. Is there any work around for this....


Regards

Gaurav

On Sat, Nov 7, 2009 at 6:54 PM, Siddiq Syed <si...@yahoo.com> wrote:
>
> Please refer the section
>
> Defining Validation Rules in the below mention link.
>
> http://docs.huihoo.com/webwork/2.2.6/Validation.html
>
> -siddiq.
>
>
> Siddiq Syed wrote:
>>
>>
>> From: gaurav nigam <ma...@gmail.com>
>> To: Struts Users Mailing List <us...@struts.apache.org>
>> Sent: Sat, November 7, 2009 1:21:41 PM
>> Subject: Re: query regarding Input Validation
>>
>> Hi Saddiq,
>> -- siddiq
>>
>> Thanks for your help....
>> I am not able to understand meaning of below line
>> You can achive this by creating an separate file for each method
>> ...do you mean that i should create separate action class for each method
>> or you mean to say separate validation file for each method of an
>> action class...
>>
>> --- Separate validation file for each action name speicifed in the
>> struts.xml ,
>> http://docs.huihoo.com/webwork/2.2.6/Validation.html
>>
>>
>>
>> By your suggestion, I need to create multiple action mappings in
>> struts.xml for each of the method of the action class....
>>
>> Its not with the method of the actin class , its the action name what is
>> been defined in the strust.xlml
>> -- For example if you have an action class user
>> UserAction.java
>> public class UserAction extends action {
>>      public String addUser(){
>>         return success;
>>     }
>>     public String modifyUser(){
>>         return success;
>>     }
>> }
>>
>> struts.xml
>> <action name="addUser"  class="UserAction" method="addUser">
>>     <result name="success'>somejsp.jsp</result>
>>     <result name="input">otherjsp.jsp</result>
>> </action>
>>
>> <action name="modifyUser"  class="UserAction" method="modifyUser">
>>     <result name="success'>somejsp.jsp</result>
>>     <result name="input">otherjsp.jsp</result>
>> </action>
>>
>> Validation files naming convection .
>>
>> UserAction-addUser-validation.xml -- when user click on adduser --this
>> validation file is going to be invoked
>> UserAction-modifyUser-validation.xml -- when user click on modifyuser --
>> this validation file is going to be invoked.
>>
>> http://docs.huihoo.com/webwork/2.2.6/Validation.html
>>
>> Note : this validation files need to be in the same package with action
>> class.
>>
>> Can we avoid this multiple action mappings by wildcard characters.....?
>>
>> -- Yes we can avoid multiple action mapping.
>>
>>
>> Please suggest your opinion.....
>>
>> I am also waiting for some reply on Question 2 I have asked on earlier
>> mail....
>>  Question 2 ?
>>
>> Thanks
>>
>> Gaurav
>>
>> On Sat, Nov 7, 2009 at 6:02 PM, Siddiq Syed <si...@yahoo.com> wrote:
>>> You can achive this by creating an seprate file for each method and add
>>> the validation.
>>> When ever the a method from the action class is invoked the corresponding
>>> validation will get invoked.
>>>
>>> actionname-aliasname-validationname.xml
>>>
>>> actinname -- name of your actin class.
>>> aliasname -- name of the action specifed in the strust-xml file.
>>>
>>> <action name="x" class="com.yaction" method="x">
>>>      <result name="input" type="tiles">validationresult.jsp</result>
>>> </action>
>>>
>>> name of the validation file for the above mention action will be
>>>
>>> yaction-x-validation.xml -- where you can define the validation and will
>>> be invoke when action x is invoked.
>>>
>>>
>>>  -Siddiq.
>>>
>>>
>>>
>>> ________________________________
>>> From: gaurav nigam <ma...@gmail.com>
>>> To: Struts Users Mailing List <us...@struts.apache.org>
>>> Sent: Sat, November 7, 2009 12:14:32 PM
>>> Subject: query regarding Input Validation
>>>
>>> Hi All,
>>>
>>> I have a query regarding input validation.
>>>
>>> # Can we use method wise input validation in struts 2 ?
>>> if this is not supported directly, then is there any workaround for the
>>> same.
>>>
>>> #To utilise the xml based validation, I have to create different
>>> action class for same module...like module is "user" and i had to
>>> create different action classes like adduser.action, modifyuser.action
>>> class etc...i have to do this as there are some fields which are
>>> different in each action....ideally i want to have single action class
>>> with different methods like add, modify, etc... to handle this..but
>>> can not do it so as same set of validation will be called for each
>>> method...which is not required in my case...
>>>
>>> After some search and study, i came to know that there is annotation
>>> validation which can be used and will be invoked per method...as
>>> mentioned in this link
>>> http://struts.apache.org/2.0.14/docs/validations-annotation.html
>>>
>>> but here, in need to hard code, my messages which i really want to
>>> avoid it, Is there any way to use property file here...please provide
>>> suggestion on this.....
>>>
>>> I have also learned that this annotation validation will not work for
>>> client side validation. Is there any work around for this....
>>>
>>>
>>> Kindly help me in this regard
>>>
>>>
>>> Thanks
>>>
>>> Gaurav
>>>
>>> ---------------------------------------------------------------------
>>> 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://old.nabble.com/query-regarding-Input-Validation-tp26246719p26247537.html
> 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
>
>

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


      

Re: query regarding Input Validation

Posted by gaurav nigam <ma...@gmail.com>.
Hi Siddiq,

My Question 2 is mentioned below

 i came to know that there is annotation  validation which can be used
and will be invoked per method...as mentioned in this link
http://struts.apache.org/2.0.14/docs/validations-annotation.html

but here, in need to hard code, my messages which i really want to
avoid it,
"Is there any way to use property file here..."
please provide suggestion on this.....

I have also learned that this annotation validation will not work for
client side validation. Is there any work around for this....


Regards

Gaurav

On Sat, Nov 7, 2009 at 6:54 PM, Siddiq Syed <si...@yahoo.com> wrote:
>
> Please refer the section
>
> Defining Validation Rules in the below mention link.
>
> http://docs.huihoo.com/webwork/2.2.6/Validation.html
>
> -siddiq.
>
>
> Siddiq Syed wrote:
>>
>>
>> From: gaurav nigam <ma...@gmail.com>
>> To: Struts Users Mailing List <us...@struts.apache.org>
>> Sent: Sat, November 7, 2009 1:21:41 PM
>> Subject: Re: query regarding Input Validation
>>
>> Hi Saddiq,
>> -- siddiq
>>
>> Thanks for your help....
>> I am not able to understand meaning of below line
>> You can achive this by creating an separate file for each method
>> ...do you mean that i should create separate action class for each method
>> or you mean to say separate validation file for each method of an
>> action class...
>>
>> --- Separate validation file for each action name speicifed in the
>> struts.xml ,
>> http://docs.huihoo.com/webwork/2.2.6/Validation.html
>>
>>
>>
>> By your suggestion, I need to create multiple action mappings in
>> struts.xml for each of the method of the action class....
>>
>> Its not with the method of the actin class , its the action name what is
>> been defined in the strust.xlml
>> -- For example if you have an action class user
>> UserAction.java
>> public class UserAction extends action {
>>      public String addUser(){
>>         return success;
>>     }
>>     public String modifyUser(){
>>         return success;
>>     }
>> }
>>
>> struts.xml
>> <action name="addUser"  class="UserAction" method="addUser">
>>     <result name="success'>somejsp.jsp</result>
>>     <result name="input">otherjsp.jsp</result>
>> </action>
>>
>> <action name="modifyUser"  class="UserAction" method="modifyUser">
>>     <result name="success'>somejsp.jsp</result>
>>     <result name="input">otherjsp.jsp</result>
>> </action>
>>
>> Validation files naming convection .
>>
>> UserAction-addUser-validation.xml -- when user click on adduser --this
>> validation file is going to be invoked
>> UserAction-modifyUser-validation.xml -- when user click on modifyuser --
>> this validation file is going to be invoked.
>>
>> http://docs.huihoo.com/webwork/2.2.6/Validation.html
>>
>> Note : this validation files need to be in the same package with action
>> class.
>>
>> Can we avoid this multiple action mappings by wildcard characters.....?
>>
>> -- Yes we can avoid multiple action mapping.
>>
>>
>> Please suggest your opinion.....
>>
>> I am also waiting for some reply on Question 2 I have asked on earlier
>> mail....
>>  Question 2 ?
>>
>> Thanks
>>
>> Gaurav
>>
>> On Sat, Nov 7, 2009 at 6:02 PM, Siddiq Syed <si...@yahoo.com> wrote:
>>> You can achive this by creating an seprate file for each method and add
>>> the validation.
>>> When ever the a method from the action class is invoked the corresponding
>>> validation will get invoked.
>>>
>>> actionname-aliasname-validationname.xml
>>>
>>> actinname -- name of your actin class.
>>> aliasname -- name of the action specifed in the strust-xml file.
>>>
>>> <action name="x" class="com.yaction" method="x">
>>>      <result name="input" type="tiles">validationresult.jsp</result>
>>> </action>
>>>
>>> name of the validation file for the above mention action will be
>>>
>>> yaction-x-validation.xml -- where you can define the validation and will
>>> be invoke when action x is invoked.
>>>
>>>
>>>  -Siddiq.
>>>
>>>
>>>
>>> ________________________________
>>> From: gaurav nigam <ma...@gmail.com>
>>> To: Struts Users Mailing List <us...@struts.apache.org>
>>> Sent: Sat, November 7, 2009 12:14:32 PM
>>> Subject: query regarding Input Validation
>>>
>>> Hi All,
>>>
>>> I have a query regarding input validation.
>>>
>>> # Can we use method wise input validation in struts 2 ?
>>> if this is not supported directly, then is there any workaround for the
>>> same.
>>>
>>> #To utilise the xml based validation, I have to create different
>>> action class for same module...like module is "user" and i had to
>>> create different action classes like adduser.action, modifyuser.action
>>> class etc...i have to do this as there are some fields which are
>>> different in each action....ideally i want to have single action class
>>> with different methods like add, modify, etc... to handle this..but
>>> can not do it so as same set of validation will be called for each
>>> method...which is not required in my case...
>>>
>>> After some search and study, i came to know that there is annotation
>>> validation which can be used and will be invoked per method...as
>>> mentioned in this link
>>> http://struts.apache.org/2.0.14/docs/validations-annotation.html
>>>
>>> but here, in need to hard code, my messages which i really want to
>>> avoid it, Is there any way to use property file here...please provide
>>> suggestion on this.....
>>>
>>> I have also learned that this annotation validation will not work for
>>> client side validation. Is there any work around for this....
>>>
>>>
>>> Kindly help me in this regard
>>>
>>>
>>> Thanks
>>>
>>> Gaurav
>>>
>>> ---------------------------------------------------------------------
>>> 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://old.nabble.com/query-regarding-Input-Validation-tp26246719p26247537.html
> 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
>
>

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


Re: query regarding Input Validation

Posted by Siddiq Syed <si...@yahoo.com>.
Please refer the section 

Defining Validation Rules in the below mention link.

http://docs.huihoo.com/webwork/2.2.6/Validation.html

-siddiq.


Siddiq Syed wrote:
> 
> 
> From: gaurav nigam <ma...@gmail.com>
> To: Struts Users Mailing List <us...@struts.apache.org>
> Sent: Sat, November 7, 2009 1:21:41 PM
> Subject: Re: query regarding Input Validation
> 
> Hi Saddiq,
> -- siddiq
> 
> Thanks for your help....
> I am not able to understand meaning of below line
> You can achive this by creating an separate file for each method
> ...do you mean that i should create separate action class for each method
> or you mean to say separate validation file for each method of an
> action class...
> 
> --- Separate validation file for each action name speicifed in the
> struts.xml , 
> http://docs.huihoo.com/webwork/2.2.6/Validation.html
> 
> 
> 
> By your suggestion, I need to create multiple action mappings in
> struts.xml for each of the method of the action class....
> 
> Its not with the method of the actin class , its the action name what is
> been defined in the strust.xlml
> -- For example if you have an action class user
> UserAction.java
> public class UserAction extends action {
>      public String addUser(){
>         return success;
>     }
>     public String modifyUser(){
>         return success;
>     } 
> }
> 
> struts.xml
> <action name="addUser"  class="UserAction" method="addUser">
>     <result name="success'>somejsp.jsp</result>
>     <result name="input">otherjsp.jsp</result>
> </action>
> 
> <action name="modifyUser"  class="UserAction" method="modifyUser">
>     <result name="success'>somejsp.jsp</result>
>     <result name="input">otherjsp.jsp</result>
> </action>
> 
> Validation files naming convection .
> 
> UserAction-addUser-validation.xml -- when user click on adduser --this
> validation file is going to be invoked
> UserAction-modifyUser-validation.xml -- when user click on modifyuser --
> this validation file is going to be invoked.
> 
> http://docs.huihoo.com/webwork/2.2.6/Validation.html
> 
> Note : this validation files need to be in the same package with action
> class.
> 
> Can we avoid this multiple action mappings by wildcard characters.....?
> 
> -- Yes we can avoid multiple action mapping. 
> 
> 
> Please suggest your opinion.....
> 
> I am also waiting for some reply on Question 2 I have asked on earlier
> mail....
>  Question 2 ?
> 
> Thanks
> 
> Gaurav
> 
> On Sat, Nov 7, 2009 at 6:02 PM, Siddiq Syed <si...@yahoo.com> wrote:
>> You can achive this by creating an seprate file for each method and add
>> the validation.
>> When ever the a method from the action class is invoked the corresponding
>> validation will get invoked.
>>
>> actionname-aliasname-validationname.xml
>>
>> actinname -- name of your actin class.
>> aliasname -- name of the action specifed in the strust-xml file.
>>
>> <action name="x" class="com.yaction" method="x">
>>      <result name="input" type="tiles">validationresult.jsp</result>
>> </action>
>>
>> name of the validation file for the above mention action will be
>>
>> yaction-x-validation.xml -- where you can define the validation and will
>> be invoke when action x is invoked.
>>
>>
>>  -Siddiq.
>>
>>
>>
>> ________________________________
>> From: gaurav nigam <ma...@gmail.com>
>> To: Struts Users Mailing List <us...@struts.apache.org>
>> Sent: Sat, November 7, 2009 12:14:32 PM
>> Subject: query regarding Input Validation
>>
>> Hi All,
>>
>> I have a query regarding input validation.
>>
>> # Can we use method wise input validation in struts 2 ?
>> if this is not supported directly, then is there any workaround for the
>> same.
>>
>> #To utilise the xml based validation, I have to create different
>> action class for same module...like module is "user" and i had to
>> create different action classes like adduser.action, modifyuser.action
>> class etc...i have to do this as there are some fields which are
>> different in each action....ideally i want to have single action class
>> with different methods like add, modify, etc... to handle this..but
>> can not do it so as same set of validation will be called for each
>> method...which is not required in my case...
>>
>> After some search and study, i came to know that there is annotation
>> validation which can be used and will be invoked per method...as
>> mentioned in this link
>> http://struts.apache.org/2.0.14/docs/validations-annotation.html
>>
>> but here, in need to hard code, my messages which i really want to
>> avoid it, Is there any way to use property file here...please provide
>> suggestion on this.....
>>
>> I have also learned that this annotation validation will not work for
>> client side validation. Is there any work around for this....
>>
>>
>> Kindly help me in this regard
>>
>>
>> Thanks
>>
>> Gaurav
>>
>> ---------------------------------------------------------------------
>> 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://old.nabble.com/query-regarding-Input-Validation-tp26246719p26247537.html
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: query regarding Input Validation

Posted by Siddiq Syed <si...@yahoo.com>.
From: gaurav nigam <ma...@gmail.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Sat, November 7, 2009 1:21:41 PM
Subject: Re: query regarding Input Validation

Hi Saddiq,
-- siddiq

Thanks for your help....
I am not able to understand meaning of below line
You can achive this by creating an separate file for each method
...do you mean that i should create separate action class for each method
or you mean to say separate validation file for each method of an
action class...

--- Separate validation file for each action name speicifed in the struts.xml , 
http://docs.huihoo.com/webwork/2.2.6/Validation.html



By your suggestion, I need to create multiple action mappings in
struts.xml for each of the method of the action class....

Its not with the method of the actin class , its the action name what is been defined in the strust.xlml
-- For example if you have an action class user
UserAction.java
public class UserAction extends action {
     public String addUser(){
        return success;
    }
    public String modifyUser(){
        return success;
    } 
}

struts.xml
<action name="addUser"  class="UserAction" method="addUser">
    <result name="success'>somejsp.jsp</result>
    <result name="input">otherjsp.jsp</result>
</action>

<action name="modifyUser"  class="UserAction" method="modifyUser">
    <result name="success'>somejsp.jsp</result>
    <result name="input">otherjsp.jsp</result>
</action>

Validation files naming convection .

UserAction-addUser-validation.xml -- when user click on adduser --this validation file is going to be invoked
UserAction-modifyUser-validation.xml -- when user click on modifyuser -- this validation file is going to be invoked.

http://docs.huihoo.com/webwork/2.2.6/Validation.html

Note : this validation files need to be in the same package with action class.

Can we avoid this multiple action mappings by wildcard characters.....?

-- Yes we can avoid multiple action mapping. 


Please suggest your opinion.....

I am also waiting for some reply on Question 2 I have asked on earlier mail....
 Question 2 ?

Thanks

Gaurav

On Sat, Nov 7, 2009 at 6:02 PM, Siddiq Syed <si...@yahoo.com> wrote:
> You can achive this by creating an seprate file for each method and add the validation.
> When ever the a method from the action class is invoked the corresponding validation will get invoked.
>
> actionname-aliasname-validationname.xml
>
> actinname -- name of your actin class.
> aliasname -- name of the action specifed in the strust-xml file.
>
> <action name="x" class="com.yaction" method="x">
>      <result name="input" type="tiles">validationresult.jsp</result>
> </action>
>
> name of the validation file for the above mention action will be
>
> yaction-x-validation.xml -- where you can define the validation and will be invoke when action x is invoked.
>
>
>  -Siddiq.
>
>
>
> ________________________________
> From: gaurav nigam <ma...@gmail.com>
> To: Struts Users Mailing List <us...@struts.apache.org>
> Sent: Sat, November 7, 2009 12:14:32 PM
> Subject: query regarding Input Validation
>
> Hi All,
>
> I have a query regarding input validation.
>
> # Can we use method wise input validation in struts 2 ?
> if this is not supported directly, then is there any workaround for the same.
>
> #To utilise the xml based validation, I have to create different
> action class for same module...like module is "user" and i had to
> create different action classes like adduser.action, modifyuser.action
> class etc...i have to do this as there are some fields which are
> different in each action....ideally i want to have single action class
> with different methods like add, modify, etc... to handle this..but
> can not do it so as same set of validation will be called for each
> method...which is not required in my case...
>
> After some search and study, i came to know that there is annotation
> validation which can be used and will be invoked per method...as
> mentioned in this link
> http://struts.apache.org/2.0.14/docs/validations-annotation.html
>
> but here, in need to hard code, my messages which i really want to
> avoid it, Is there any way to use property file here...please provide
> suggestion on this.....
>
> I have also learned that this annotation validation will not work for
> client side validation. Is there any work around for this....
>
>
> Kindly help me in this regard
>
>
> Thanks
>
> Gaurav
>
> ---------------------------------------------------------------------
> 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: query regarding Input Validation

Posted by gaurav nigam <ma...@gmail.com>.
Hi Saddiq,

Thanks for your help....
I am not able to understand meaning of below line
You can achive this by creating an separate file for each method
...do you mean that i should create separate action class for each method
or you mean to say separate validation file for each method of an
action class...

By your suggestion, I need to create multiple action mappings in
struts.xml for each of the method of the action class....

Can we avoid this multiple action mappings by wildcard characters.....?

Please suggest your opinion.....

I am also waiting for some reply on Question 2 I have asked on earlier mail....


Thanks

Gaurav

On Sat, Nov 7, 2009 at 6:02 PM, Siddiq Syed <si...@yahoo.com> wrote:
> You can achive this by creating an seprate file for each method and add the validation.
> When ever the a method from the action class is invoked the corresponding validation will get invoked.
>
> actionname-aliasname-validationname.xml
>
> actinname -- name of your actin class.
> aliasname -- name of the action specifed in the strust-xml file.
>
> <action name="x" class="com.yaction" method="x">
>      <result name="input" type="tiles">validationresult.jsp</result>
> </action>
>
> name of the validation file for the above mention action will be
>
> yaction-x-validation.xml -- where you can define the validation and will be invoke when action x is invoked.
>
>
>  -Siddiq.
>
>
>
> ________________________________
> From: gaurav nigam <ma...@gmail.com>
> To: Struts Users Mailing List <us...@struts.apache.org>
> Sent: Sat, November 7, 2009 12:14:32 PM
> Subject: query regarding Input Validation
>
> Hi All,
>
> I have a query regarding input validation.
>
> # Can we use method wise input validation in struts 2 ?
> if this is not supported directly, then is there any workaround for the same.
>
> #To utilise the xml based validation, I have to create different
> action class for same module...like module is "user" and i had to
> create different action classes like adduser.action, modifyuser.action
> class etc...i have to do this as there are some fields which are
> different in each action....ideally i want to have single action class
> with different methods like add, modify, etc... to handle this..but
> can not do it so as same set of validation will be called for each
> method...which is not required in my case...
>
> After some search and study, i came to know that there is annotation
> validation which can be used and will be invoked per method...as
> mentioned in this link
> http://struts.apache.org/2.0.14/docs/validations-annotation.html
>
> but here, in need to hard code, my messages which i really want to
> avoid it, Is there any way to use property file here...please provide
> suggestion on this.....
>
> I have also learned that this annotation validation will not work for
> client side validation. Is there any work around for this....
>
>
> Kindly help me in this regard
>
>
> Thanks
>
> Gaurav
>
> ---------------------------------------------------------------------
> 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: query regarding Input Validation

Posted by Siddiq Syed <si...@yahoo.com>.
You can achive this by creating an seprate file for each method and add the validation.
When ever the a method from the action class is invoked the corresponding validation will get invoked.

actionname-aliasname-validationname.xml

actinname -- name of your actin class.
aliasname -- name of the action specifed in the strust-xml file.

<action name="x" class="com.yaction" method="x">
     <result name="input" type="tiles">validationresult.jsp</result>
</action>

name of the validation file for the above mention action will be 

yaction-x-validation.xml -- where you can define the validation and will be invoke when action x is invoked.


 -Siddiq.



________________________________
From: gaurav nigam <ma...@gmail.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Sat, November 7, 2009 12:14:32 PM
Subject: query regarding Input Validation

Hi All,

I have a query regarding input validation.

# Can we use method wise input validation in struts 2 ?
if this is not supported directly, then is there any workaround for the same.

#To utilise the xml based validation, I have to create different
action class for same module...like module is "user" and i had to
create different action classes like adduser.action, modifyuser.action
class etc...i have to do this as there are some fields which are
different in each action....ideally i want to have single action class
with different methods like add, modify, etc... to handle this..but
can not do it so as same set of validation will be called for each
method...which is not required in my case...

After some search and study, i came to know that there is annotation
validation which can be used and will be invoked per method...as
mentioned in this link
http://struts.apache.org/2.0.14/docs/validations-annotation.html

but here, in need to hard code, my messages which i really want to
avoid it, Is there any way to use property file here...please provide
suggestion on this.....

I have also learned that this annotation validation will not work for
client side validation. Is there any work around for this....


Kindly help me in this regard


Thanks

Gaurav

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