• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

struts 2 validation

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 !!!
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic