You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brice Ruth <br...@fiskars.com> on 2003/12/30 19:02:41 UTC

server-side validation with Validator

OK, I have to admit, I'm a bit confused using Validator, despite looking 
at the online docs & having Ted's excellent book at hand.

I have everything setup to do server-side validation, as far as I can 
tell ... I've set a breakpoint in DynaValidatorActionForm.validate and 
it is getting called ... to test if the validation is working, I've 
disabled the JavaScript validation by removing the onsubmit call for my 
<html:form> element ... fine, now I can submit non-valid data. However, 
I keep getting to my Action, instead of being shunted back to the input 
page. My input page is defined as a tile definition, here's what my 
struts-config.xml looks like (for that section):

<action
    path="/US/garden/resources/orangeThumbApply"
    type="com.fiskars.struts.actions.OrangeThumbSaveData"
    name="orangeThumbApp"
    scope="request"
    validate="true"
    input="garden.orangeThumbForm">
    <forward
        name="success"
        path="garden.orangeThumbThankyou"/>
</action>

Does anyone see anything wrong here? To test the validation, I've left 
out a required field and I've entered a text string for a numeric 
(short) value.

My JavaScript validation seems to be working like a champ, but the 
server-side stuff seems MIA, even though its being called.

TIA

-- 
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


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


Re: server-side validation with Validator

Posted by Brice Ruth <br...@fiskars.com>.
Aha, ok ... got it now. Thanks!

Robert Taylor wrote:

>One could use DynaValidatorActionForm for wizard processes that used the
>same form but
>validate different fields based on the path.
>
>robert
>
>  
>
>>-----Original Message-----
>>From: Brice Ruth [mailto:bruth@fiskars.com]
>>Sent: Tuesday, December 30, 2003 1:29 PM
>>To: Struts Users Mailing List
>>Subject: Re: server-side validation with Validator
>>
>>
>>Yeah, I read pretty much exactly that in Ted's book, but I have to
>>admit, I'm not entirely sure what it means ... someone previously also
>>mentioned that the DynaValidatorForm uses the "name" attribute of the
>>action definition, whereas the DynaValidatorActionForm uses the "path"
>>... well, my "path" is the path for the Action ... I'm not sure under
>>what circumstances one would use DynaValidatorActionForm, I guess ...
>>
>>Matthias Wessendorf wrote:
>>
>>    
>>
>>>Hi,
>>>
>>>The DynaValidatorForm will match the formset name with the form-bean
>>>name.
>>>it uses mapping.getAttribute() to init the validator
>>>
>>>
>>>The DynaValidatorActionForm will match the formset name with the
>>>action-mapping path.
>>>it uses mapping.getPath() for init the validator
>>>
>>>-----Original Message-----
>>>From: Brice Ruth [mailto:bruth@fiskars.com]
>>>Sent: Tuesday, December 30, 2003 7:11 PM
>>>To: Struts Users Mailing List
>>>Subject: Re: server-side validation with Validator
>>>
>>>
>>>OK, nevermind ... I just needed to change DynaValidatorActionForm to
>>>DynaValidatorForm ... now it works.
>>>
>>>Brice Ruth wrote:
>>>
>>>
>>>
>>>      
>>>
>>>>OK, I have to admit, I'm a bit confused using Validator, despite
>>>>looking at the online docs & having Ted's excellent book at hand.
>>>>
>>>>I have everything setup to do server-side validation, as far as I can
>>>>tell ... I've set a breakpoint in DynaValidatorActionForm.validate and
>>>>
>>>>
>>>>        
>>>>
>>>
>>>      
>>>
>>>>it is getting called ... to test if the validation is working, I've
>>>>disabled the JavaScript validation by removing the onsubmit call for
>>>>my <html:form> element ... fine, now I can submit non-valid data.
>>>>However, I keep getting to my Action, instead of being shunted back to
>>>>
>>>>
>>>>        
>>>>
>>>
>>>      
>>>
>>>>the input page. My input page is defined as a tile definition, here's
>>>>what my struts-config.xml looks like (for that section):
>>>>
>>>><action
>>>>  path="/US/garden/resources/orangeThumbApply"
>>>>  type="com.fiskars.struts.actions.OrangeThumbSaveData"
>>>>  name="orangeThumbApp"
>>>>  scope="request"
>>>>  validate="true"
>>>>  input="garden.orangeThumbForm">
>>>>  <forward
>>>>      name="success"
>>>>      path="garden.orangeThumbThankyou"/>
>>>></action>
>>>>
>>>>Does anyone see anything wrong here? To test the validation, I've left
>>>>out a required field and I've entered a text string for a numeric
>>>>(short) value.
>>>>
>>>>My JavaScript validation seems to be working like a champ, but the
>>>>server-side stuff seems MIA, even though its being called.
>>>>
>>>>TIA
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>
>>>      
>>>
>>--
>>Brice D. Ruth
>>Sr. IT Analyst
>>Fiskars Brands, Inc.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>  
>

-- 
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


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


RE: server-side validation with Validator

Posted by Robert Taylor <rt...@mulework.com>.
One could use DynaValidatorActionForm for wizard processes that used the
same form but
validate different fields based on the path.

robert

> -----Original Message-----
> From: Brice Ruth [mailto:bruth@fiskars.com]
> Sent: Tuesday, December 30, 2003 1:29 PM
> To: Struts Users Mailing List
> Subject: Re: server-side validation with Validator
>
>
> Yeah, I read pretty much exactly that in Ted's book, but I have to
> admit, I'm not entirely sure what it means ... someone previously also
> mentioned that the DynaValidatorForm uses the "name" attribute of the
> action definition, whereas the DynaValidatorActionForm uses the "path"
> ... well, my "path" is the path for the Action ... I'm not sure under
> what circumstances one would use DynaValidatorActionForm, I guess ...
>
> Matthias Wessendorf wrote:
>
> >Hi,
> >
> >The DynaValidatorForm will match the formset name with the form-bean
> >name.
> >it uses mapping.getAttribute() to init the validator
> >
> >
> >The DynaValidatorActionForm will match the formset name with the
> >action-mapping path.
> >it uses mapping.getPath() for init the validator
> >
> >-----Original Message-----
> >From: Brice Ruth [mailto:bruth@fiskars.com]
> >Sent: Tuesday, December 30, 2003 7:11 PM
> >To: Struts Users Mailing List
> >Subject: Re: server-side validation with Validator
> >
> >
> >OK, nevermind ... I just needed to change DynaValidatorActionForm to
> >DynaValidatorForm ... now it works.
> >
> >Brice Ruth wrote:
> >
> >
> >
> >>OK, I have to admit, I'm a bit confused using Validator, despite
> >>looking at the online docs & having Ted's excellent book at hand.
> >>
> >>I have everything setup to do server-side validation, as far as I can
> >>tell ... I've set a breakpoint in DynaValidatorActionForm.validate and
> >>
> >>
> >
> >
> >
> >>it is getting called ... to test if the validation is working, I've
> >>disabled the JavaScript validation by removing the onsubmit call for
> >>my <html:form> element ... fine, now I can submit non-valid data.
> >>However, I keep getting to my Action, instead of being shunted back to
> >>
> >>
> >
> >
> >
> >>the input page. My input page is defined as a tile definition, here's
> >>what my struts-config.xml looks like (for that section):
> >>
> >><action
> >>   path="/US/garden/resources/orangeThumbApply"
> >>   type="com.fiskars.struts.actions.OrangeThumbSaveData"
> >>   name="orangeThumbApp"
> >>   scope="request"
> >>   validate="true"
> >>   input="garden.orangeThumbForm">
> >>   <forward
> >>       name="success"
> >>       path="garden.orangeThumbThankyou"/>
> >></action>
> >>
> >>Does anyone see anything wrong here? To test the validation, I've left
> >>out a required field and I've entered a text string for a numeric
> >>(short) value.
> >>
> >>My JavaScript validation seems to be working like a champ, but the
> >>server-side stuff seems MIA, even though its being called.
> >>
> >>TIA
> >>
> >>
> >>
> >
> >
> >
>
> --
> Brice D. Ruth
> Sr. IT Analyst
> Fiskars Brands, Inc.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: server-side validation with Validator

Posted by Brice Ruth <br...@fiskars.com>.
Yeah, I read pretty much exactly that in Ted's book, but I have to 
admit, I'm not entirely sure what it means ... someone previously also 
mentioned that the DynaValidatorForm uses the "name" attribute of the 
action definition, whereas the DynaValidatorActionForm uses the "path" 
... well, my "path" is the path for the Action ... I'm not sure under 
what circumstances one would use DynaValidatorActionForm, I guess ...

Matthias Wessendorf wrote:

>Hi,
>
>The DynaValidatorForm will match the formset name with the form-bean
>name.
>it uses mapping.getAttribute() to init the validator
>
>
>The DynaValidatorActionForm will match the formset name with the
>action-mapping path.
>it uses mapping.getPath() for init the validator
>
>-----Original Message-----
>From: Brice Ruth [mailto:bruth@fiskars.com] 
>Sent: Tuesday, December 30, 2003 7:11 PM
>To: Struts Users Mailing List
>Subject: Re: server-side validation with Validator
>
>
>OK, nevermind ... I just needed to change DynaValidatorActionForm to 
>DynaValidatorForm ... now it works.
>
>Brice Ruth wrote:
>
>  
>
>>OK, I have to admit, I'm a bit confused using Validator, despite
>>looking at the online docs & having Ted's excellent book at hand.
>>
>>I have everything setup to do server-side validation, as far as I can
>>tell ... I've set a breakpoint in DynaValidatorActionForm.validate and
>>    
>>
>
>  
>
>>it is getting called ... to test if the validation is working, I've 
>>disabled the JavaScript validation by removing the onsubmit call for 
>>my <html:form> element ... fine, now I can submit non-valid data. 
>>However, I keep getting to my Action, instead of being shunted back to
>>    
>>
>
>  
>
>>the input page. My input page is defined as a tile definition, here's 
>>what my struts-config.xml looks like (for that section):
>>
>><action
>>   path="/US/garden/resources/orangeThumbApply"
>>   type="com.fiskars.struts.actions.OrangeThumbSaveData"
>>   name="orangeThumbApp"
>>   scope="request"
>>   validate="true"
>>   input="garden.orangeThumbForm">
>>   <forward
>>       name="success"
>>       path="garden.orangeThumbThankyou"/>
>></action>
>>
>>Does anyone see anything wrong here? To test the validation, I've left
>>out a required field and I've entered a text string for a numeric 
>>(short) value.
>>
>>My JavaScript validation seems to be working like a champ, but the
>>server-side stuff seems MIA, even though its being called.
>>
>>TIA
>>
>>    
>>
>
>  
>

-- 
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


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


RE: server-side validation with Validator

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
Hi,

The DynaValidatorForm will match the formset name with the form-bean
name.
it uses mapping.getAttribute() to init the validator


The DynaValidatorActionForm will match the formset name with the
action-mapping path.
it uses mapping.getPath() for init the validator

-----Original Message-----
From: Brice Ruth [mailto:bruth@fiskars.com] 
Sent: Tuesday, December 30, 2003 7:11 PM
To: Struts Users Mailing List
Subject: Re: server-side validation with Validator


OK, nevermind ... I just needed to change DynaValidatorActionForm to 
DynaValidatorForm ... now it works.

Brice Ruth wrote:

> OK, I have to admit, I'm a bit confused using Validator, despite
> looking at the online docs & having Ted's excellent book at hand.
>
> I have everything setup to do server-side validation, as far as I can
> tell ... I've set a breakpoint in DynaValidatorActionForm.validate and

> it is getting called ... to test if the validation is working, I've 
> disabled the JavaScript validation by removing the onsubmit call for 
> my <html:form> element ... fine, now I can submit non-valid data. 
> However, I keep getting to my Action, instead of being shunted back to

> the input page. My input page is defined as a tile definition, here's 
> what my struts-config.xml looks like (for that section):
>
> <action
>    path="/US/garden/resources/orangeThumbApply"
>    type="com.fiskars.struts.actions.OrangeThumbSaveData"
>    name="orangeThumbApp"
>    scope="request"
>    validate="true"
>    input="garden.orangeThumbForm">
>    <forward
>        name="success"
>        path="garden.orangeThumbThankyou"/>
> </action>
>
> Does anyone see anything wrong here? To test the validation, I've left
> out a required field and I've entered a text string for a numeric 
> (short) value.
>
> My JavaScript validation seems to be working like a champ, but the
> server-side stuff seems MIA, even though its being called.
>
> TIA
>

-- 
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


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


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


Re: server-side validation with Validator

Posted by Brice Ruth <br...@fiskars.com>.
OK, nevermind ... I just needed to change DynaValidatorActionForm to 
DynaValidatorForm ... now it works.

Brice Ruth wrote:

> OK, I have to admit, I'm a bit confused using Validator, despite 
> looking at the online docs & having Ted's excellent book at hand.
>
> I have everything setup to do server-side validation, as far as I can 
> tell ... I've set a breakpoint in DynaValidatorActionForm.validate and 
> it is getting called ... to test if the validation is working, I've 
> disabled the JavaScript validation by removing the onsubmit call for 
> my <html:form> element ... fine, now I can submit non-valid data. 
> However, I keep getting to my Action, instead of being shunted back to 
> the input page. My input page is defined as a tile definition, here's 
> what my struts-config.xml looks like (for that section):
>
> <action
>    path="/US/garden/resources/orangeThumbApply"
>    type="com.fiskars.struts.actions.OrangeThumbSaveData"
>    name="orangeThumbApp"
>    scope="request"
>    validate="true"
>    input="garden.orangeThumbForm">
>    <forward
>        name="success"
>        path="garden.orangeThumbThankyou"/>
> </action>
>
> Does anyone see anything wrong here? To test the validation, I've left 
> out a required field and I've entered a text string for a numeric 
> (short) value.
>
> My JavaScript validation seems to be working like a champ, but the 
> server-side stuff seems MIA, even though its being called.
>
> TIA
>

-- 
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


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