This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

struts 2 validation  RSS feed

 
Bunty Paul
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At the top of the page add <s:actionerror />

hope this help.
 
Bunty Paul
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!