• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Display error messages in struts

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,
Iam new to struts, but presently working on it, how should display error messages by making the labels of the respective textboxs in a different color(for ex: say if First Name invalid then First Name in red) if possible plz do provide an example.

regards
shyam
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Struts does not specifically provide any error handling for each and every form field like text box labels in your case. What it provides is a framework for error handling using the struts ActionError. You can add many such ActionError objects to an ActionErrors object in the Action class. Using saveErrors(request, ActionErrors) method provided in the action class, you can save the ActionErrors in the request. This can be accessed on the jsp by including the tag <html:errors/>. This will display all the errors that have been added via ActionErrors.
For your specific problem you might have to employ some logic to each of the form field labels and play on with their fonts. So, in the form bean you will probably need to keep the status of error for each of the form fields and then use that information to display the label in relevant font.
[ December 02, 2004: Message edited by: Dharmanand Singh ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic