Re: passing form parameters to a custom validator
2009/5/19 manub : > I'm trying to write a custom field validator which needs other fields to > validate the field I need to validate. How can I pass field values (and not > static params) to a field validator in the validation xml? I'm using Struts > 2.1.6. Did you try ${fieldFromAction} ? Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: passing form parameters to a custom validator
Yes, I did. But in the action the string takes the value "${field}" and not the field value. Lukasz Lenart wrote: > > 2009/5/19 manub : >> I'm trying to write a custom field validator which needs other fields to >> validate the field I need to validate. How can I pass field values (and >> not >> static params) to a field validator in the validation xml? I'm using >> Struts >> 2.1.6. > > Did you try ${fieldFromAction} ? > > > Regards > -- > Lukasz > http://www.lenart.org.pl/ > > - > 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://www.nabble.com/passing-form-parameters-to-a-custom-validator-tp23615918p23630243.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
Re: passing form parameters to a custom validator
2009/5/20 manub : > Yes, I did. But in the action the string takes the value "${field}" and not > the field value. Frankly, I don't understand, are you trying to pass data from validator xml configuration to action? Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: passing form parameters to a custom validator
Lukasz Lenart wrote: > > Frankly, I don't understand, are you trying to pass data from > validator xml configuration to action? > I've written a custom field validator, which needs other field values to validate his field. I need a way to pass that values to that field validator. -- View this message in context: http://www.nabble.com/passing-form-parameters-to-a-custom-validator-tp23615918p23630526.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
Re: passing form parameters to a custom validator
2009/5/20 manub : > I've written a custom field validator, which needs other field values to > validate his field. I need a way to pass that values to that field > validator. Did you try to use param tag as below? $...@pl.org.lenart.ems.model.employeetype@.value() != 'dd'} error.employee.type.required Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: passing form parameters to a custom validator
I think that this may work for the expression validator because you are supplying an expression. Maybe I need to use an expression too, but I don't know how to evaluate it within my Java class for Validator. Lukasz Lenart wrote: > > 2009/5/20 manub : >> I've written a custom field validator, which needs other field values to >> validate his field. I need a way to pass that values to that field >> validator. > > Did you try to use param tag as below? > > > > $...@pl.org.lenart.ems.model.employeetype@.value() > != 'dd'} > error.employee.type.required > > > > > > > Regards > -- > Lukasz > http://www.lenart.org.pl/ > > - > 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://www.nabble.com/passing-form-parameters-to-a-custom-validator-tp23615918p23649333.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
Re: passing form parameters to a custom validator
2009/5/21 manub : > I think that this may work for the expression validator because you are > supplying an expression. I've been thinking about tag, with it you can set any field in your validator and it can be an OGNL expression. Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: passing form parameters to a custom validator
Rather than pass this, that and the other parameter(s) to your validator, why not just retrieve what you need from inside the validator? You have the ActionInvocation passed to your doIntercept(...), which contains the ValueStack containing your objects. Peace, Scott On Tue, May 19, 2009 at 7:59 AM, manub wrote: > > Hi all, > > I'm trying to write a custom field validator which needs other fields to > validate the field I need to validate. How can I pass field values (and not > static params) to a field validator in the validation xml? I'm using Struts > 2.1.6. > > Thank you. > -- > View this message in context: > http://www.nabble.com/passing-form-parameters-to-a-custom-validator-tp23615918p23615918.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 > >
Re: passing form parameters to a custom validator
Did it this way. Passed field names via the tag, then obtained values inside the validator class using getFieldValue(fieldName, object). Thank you for suggestions. stanlick wrote: > > Rather than pass this, that and the other parameter(s) to your validator, > why not just retrieve what you need from inside the validator? You have > the > ActionInvocation passed to your doIntercept(...), which contains the > ValueStack containing your objects. > > Peace, > Scott > > > > On Tue, May 19, 2009 at 7:59 AM, manub wrote: > >> >> Hi all, >> >> I'm trying to write a custom field validator which needs other fields to >> validate the field I need to validate. How can I pass field values (and >> not >> static params) to a field validator in the validation xml? I'm using >> Struts >> 2.1.6. >> >> Thank you. >> -- >> View this message in context: >> http://www.nabble.com/passing-form-parameters-to-a-custom-validator-tp23615918p23615918.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 >> >> > > -- View this message in context: http://www.nabble.com/passing-form-parameters-to-a-custom-validator-tp23615918p23651619.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