You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vincent <vi...@xaymaca.com> on 2005/05/10 18:47:39 UTC

Validating LazyValidatorForm

Hello All,
As the subject says I am having some trouble
trying to validate a LazyValidatorForm. Using the great examples
on the LazyValidatorForm page I created a custom class with
the required: setPathValidation(true) in the
constructor.

The Action path calling the form is "/AddBoxAction"
and validation= "true"


the following is from validation.xml:

  <form name="/AddBoxAction">
   <field property="howManyNewBoxes"
    depends="required">
            <msg key="errors.required" name="required"/>
             </field>
         </form>


The above is just the latest iteration, nothing I try seems
to have any effect at all on what I type in this text field.


from the log I get:

RequestProcessor: Processing a 'POST' for path '/AddBoxAction'
RequestUtils:  Looking for ActionForm bean instance in scope 'session' 
under attribute key 'eddForm'
RequestUtils:  Can recycle existing ActionForm instance of type 
'xxx.webapp.forms.NestedLazyForm'?: true
RequestUtils:  --> xxx.webapp.forms.NestedLazyForm@e28dd3
RequestProcessor:  Storing ActionForm bean instance in scope 'session' 
under attribute key 'eddForm'
RequestProcessor:  Populating bean properties from this request
RequestProcessor:  Validating input form properties
BeanValidatorForm: Validating ActionForm 'eddForm' using key 
'AddBoxAction' for mapping '/AddBoxAction'
RequestProcessor:   No errors detected, accepting input

This is right after I submitted a form with an empty textbox with the
property of "howManyNewBoxes"

Is everyone else able to validate ok?

Thanks in advance,
Vincent


-- 
Plato is my friend, Aristotle is my friend, but my greatest friend is truth.
- Isaac Newton

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


Re: Validating LazyValidatorForm

Posted by Michael Jouravlev <jm...@gmail.com>.
I find things like this disturbing:

=== cut here ===
BeanValidatorForm: Validating ActionForm 'eddForm' using key
 'AddBoxAction' for mapping '/AddBoxAction'
RequestProcessor:   No errors detected, accepting input
=== cut here ===

If validator cannot not match key and mapping, should not it throw an
exception right away, instead of accepting input? Is not this a bug?

Michael.

On 5/10/05, Vincent <vi...@xaymaca.com> wrote:
> took the leading "/" in validation.xml. Works like a charm now.
> Thanks!
> 
> Niall Pemberton wrote:
> > If you use "setPathValidation(true)" it uses a key of the path name - with
> > the leading "/" stripped off. Either you need to specify the form name in
> > your validation.xml without the leading "/" - or in your custom class
> > override the getValidationKey() method (rather than using  the
> > setPathValidation() method):
> >
> > public String getValidationKey(ActionMapping mapping,
> >                               HttpServletRequest request) {
> >     return mapping.getPath();
> > }
> >
> > Niall
> >
> > ----- Original Message -----
> > From: "Vincent" <vi...@xaymaca.com>
> > Sent: Tuesday, May 10, 2005 5:47 PM
> >
> >
> >
> >>Hello All,
> >>As the subject says I am having some trouble
> >>trying to validate a LazyValidatorForm. Using the great examples
> >>on the LazyValidatorForm page I created a custom class with
> >>the required: setPathValidation(true) in the
> >>constructor.
> >>
> >>The Action path calling the form is "/AddBoxAction"
> >>and validation= "true"
> >>
> >>
> >>the following is from validation.xml:
> >>
> >>  <form name="/AddBoxAction">
> >>   <field property="howManyNewBoxes"
> >>    depends="required">
> >>            <msg key="errors.required" name="required"/>
> >>             </field>
> >>         </form>
> >>
> >>
> >>The above is just the latest iteration, nothing I try seems
> >>to have any effect at all on what I type in this text field.
>
> from the log I get:
> 
> RequestProcessor: Processing a 'POST' for path '/AddBoxAction'
> RequestUtils:  Looking for ActionForm bean instance in scope 'session'
> under attribute key 'eddForm'
> RequestUtils:  Can recycle existing ActionForm instance of type
> 'xxx.webapp.forms.NestedLazyForm'?: true
> RequestUtils:  --> xxx.webapp.forms.NestedLazyForm@e28dd3
> RequestProcessor:  Storing ActionForm bean instance in scope 'session'
> under attribute key 'eddForm'
> RequestProcessor:  Populating bean properties from this request
> RequestProcessor:  Validating input form properties
> BeanValidatorForm: Validating ActionForm 'eddForm' using key
> 'AddBoxAction' for mapping '/AddBoxAction'
> RequestProcessor:   No errors detected, accepting input

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


Re: Validating LazyValidatorForm

Posted by Vincent <vi...@xaymaca.com>.
took the leading "/" in validation.xml. Works like a charm now.
Thanks!

Niall Pemberton wrote:
> If you use "setPathValidation(true)" it uses a key of the path name - with
> the leading "/" stripped off. Either you need to specify the form name in
> your validation.xml without the leading "/" - or in your custom class
> override the getValidationKey() method (rather than using  the
> setPathValidation() method):
> 
> public String getValidationKey(ActionMapping mapping,
>                               HttpServletRequest request) {
>     return mapping.getPath();
> }
> 
> Niall
> 
> ----- Original Message ----- 
> From: "Vincent" <vi...@xaymaca.com>
> Sent: Tuesday, May 10, 2005 5:47 PM
> 
> 
> 
>>Hello All,
>>As the subject says I am having some trouble
>>trying to validate a LazyValidatorForm. Using the great examples
>>on the LazyValidatorForm page I created a custom class with
>>the required: setPathValidation(true) in the
>>constructor.
>>
>>The Action path calling the form is "/AddBoxAction"
>>and validation= "true"
>>
>>
>>the following is from validation.xml:
>>
>>  <form name="/AddBoxAction">
>>   <field property="howManyNewBoxes"
>>    depends="required">
>>            <msg key="errors.required" name="required"/>
>>             </field>
>>         </form>
>>
>>
>>The above is just the latest iteration, nothing I try seems
>>to have any effect at all on what I type in this text field.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


-- 
Plato is my friend, Aristotle is my friend, but my greatest friend is truth.
- Isaac Newton

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


Re: Validating LazyValidatorForm

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
If you use "setPathValidation(true)" it uses a key of the path name - with
the leading "/" stripped off. Either you need to specify the form name in
your validation.xml without the leading "/" - or in your custom class
override the getValidationKey() method (rather than using  the
setPathValidation() method):

public String getValidationKey(ActionMapping mapping,
                              HttpServletRequest request) {
    return mapping.getPath();
}

Niall

----- Original Message ----- 
From: "Vincent" <vi...@xaymaca.com>
Sent: Tuesday, May 10, 2005 5:47 PM


> Hello All,
> As the subject says I am having some trouble
> trying to validate a LazyValidatorForm. Using the great examples
> on the LazyValidatorForm page I created a custom class with
> the required: setPathValidation(true) in the
> constructor.
>
> The Action path calling the form is "/AddBoxAction"
> and validation= "true"
>
>
> the following is from validation.xml:
>
>   <form name="/AddBoxAction">
>    <field property="howManyNewBoxes"
>     depends="required">
>             <msg key="errors.required" name="required"/>
>              </field>
>          </form>
>
>
> The above is just the latest iteration, nothing I try seems
> to have any effect at all on what I type in this text field.



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