This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts + Error Message Display Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts + Error Message Display" Watch "Struts + Error Message Display" New topic

Struts + Error Message Display

Sai P Kumar

Joined: Jan 22, 2004
Posts: 11
Subject: Display error messages (Validation errors) using Struts validation frame work.
Problem: I plan to display input validation errors using struts frame work. the problem is, with this frame work all errors are displayed at the top of the page (JSP). But say there are ten feilds, HOW WOULD I DISPLAY VALIDATION ERROR AT THE LOACTION OF THE ERROR FEILD RATHER THEN AT THE TOP OF THE PAGE.
Thank you.
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
The error displaying features in JSP/Struts are quite flexible. When adding an ActionMessage to your ActionErrors, specify a key that is unique to that field, then pick it up on the JSP side with a logic:messagesPresent name='theKeyYouSpecified' tag ie:

*or any other Sai P Kumar approved user unfriendly error message
ps: don't yell, it's not our fault if you don't read the documentation
Consider Paul's rocket mass heater.
subject: Struts + Error Message Display
Similar Threads
Problem in displaying message using resource bundle for validation framework
Struts 2 + <d:submit /> + Selecting Targets based on the return value
Displaying validation error messages only at the top in struts 2
Change of URL upon validation in jsp