GeeCON Prague 2014*
The moose likes Struts and the fly likes Struts 1.3: validation via xml stops on first error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 1.3: validation via xml stops on first error" Watch "Struts 1.3: validation via xml stops on first error" New topic
Author

Struts 1.3: validation via xml stops on first error

Fran Cricket
Greenhorn

Joined: Nov 03, 2012
Posts: 9
Hi,
I have a form with some fields required. If I submit the form without specifying a value for all those fields, only the first message error is displayed. Moreover, if I set a value for that field and resubmit the form, the others fields aren't validated and the form is sent.

I tried to set property stopOnFirstError value to false in the struts-config.xml:

In the jsp in which there is the form I have

for each property required.

Bye,
Cri
manovemula vemula
Greenhorn

Joined: Aug 20, 2012
Posts: 5
Hi....
In the validator.xml file you have to mention the form name and field property ,depends ,and the argument keys....


see for example is there username field is availabule you have to set the validation to that field like in the following

<form name="what ever your mentioned in the struts-config.xml file">
<field property="name of the property" depends="what are the validations you want to added the field"
<arg key="what is the message you have to disply wen the user not enter the data">
</field>

like this you have to mention validation for all the fileds,,,,,,,,,


EXample

<form name="userregistrationform">
<field property="username" depends="required,minlength,maxlength">
<arg key="username "resource="false"/>
<field>


Fran Cricket
Greenhorn

Joined: Nov 03, 2012
Posts: 9
manovemula vemula wrote:Hi....
In the validator.xml file you have to mention the form name and field property ,depends ,and the argument keys....


see for example is there username field is availabule you have to set the validation to that field like in the following

<form name="what ever your mentioned in the struts-config.xml file">
<field property="name of the property" depends="what are the validations you want to added the field"
<arg key="what is the message you have to disply wen the user not enter the data">
</field>

like this you have to mention validation for all the fileds,,,,,,,,,


EXample

<form name="userregistrationform">
<field property="username" depends="required,minlength,maxlength">
<arg key="username "resource="false"/>
<field>




Thank you for the example.
I used more than one form tag for the same form.
Now it works, but I have still some problems with validwhen and with properties required if a selection has a certain value.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Struts 1.3: validation via xml stops on first error