Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Render All and Individual Errors in One Page

 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My JSP need to report (1) all errors in one place and (2) individual form property's error at their specific location using <html:errors/>. I know a common way is first to add these into resource bundle:

errors.header=<p>Errors Encountered</p><font color=red><ol>
errors.footer=</ol></font>
errors.prefix=<li>
errors.suffix=</li>

Then, I put one <html:errors/> at the top for list of all errors and <html:errors property="propertyname"/> next to each input element for the corresponding property.

Now with this approach, I have a problem where the headers/prefix got printed in my individual error list, too. I just want it be printed at the all error list at the top.

Is there any way to print the headers/prefix for <html:errors/> while leaving them out at each specific <html:errors property="..."/> tag?
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

u dont have such an option with struts 1.1 but after the release of struts 1.2 they had provided all these header,footer,prefix and all as the attributes for the error tag
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic