wood burning stoves 2.0*
The moose likes Struts and the fly likes struts 2 validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts 2 validation" Watch "struts 2 validation" New topic
Author

struts 2 validation

Bunty Paul
Greenhorn

Joined: Jun 26, 2006
Posts: 28
I did some validation for the fields in my JSP using struts 2 taglib.
It uses field validator which displays the actionerrors above every field.

But i want to specify that actionerrors be displayed only at the top of the page. How can i do this.
Reda Mokrane
Ranch Hand

Joined: Jul 25, 2001
Posts: 237
At the top of the page add <s:actionerror />

hope this help.
Bunty Paul
Greenhorn

Joined: Jun 26, 2006
Posts: 28
Thank you Reda Mokrane.

It helps, for actionerrors. But i need to change my fielderrors to actionerrors. And that definitely gives me pain.

Ok thats how the struts 2 has been designed. What can we do? Oops!
Bunty Paul
Greenhorn

Joined: Jun 26, 2006
Posts: 28
Hey, I have figured out the solution.

Thank me, there was a solution.


just set the theme attribute of the form to the value 'simple'.

for example:

<code>
<s:form action="myaction.do" theme="simple">
</code>

It's that simple !!!
palas das
Greenhorn

Joined: May 09, 2007
Posts: 9
Actually I have created one action class , one jsp,two field for input,and one validation.xml file. field-validator type="requiredstring"> for this line in the xml file anything I have to do or not?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: struts 2 validation