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 <siddiq...@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 <mailgaura...@gmail.com> >> To: Struts Users Mailing List <user@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 <siddiq...@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 <mailgaura...@gmail.com> >>> To: Struts Users Mailing List <user@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-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@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-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org