This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes errors.header in struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "errors.header in struts2" Watch "errors.header in struts2" New topic
Author

errors.header in struts2

Che Frenz
Greenhorn

Joined: Dec 15, 2008
Posts: 14
Hi!
In struts 1 there is an option to specify an error header and footer.
Ex. errors.header=<div class="errorMsg"><b>The following errors have occurred: </b><ul class="errorMsg">

I can't seem to find out how to do this in struts2. I tried the same thing but it doesn't seem to change the errors.

Any ideas?
Thanks!
Che
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

There isn't equivalent functionality out-of-the-box.

You can check for the presence of errors and do it manually, though. Personally I never cared for putting HTML in the properties file so for me it's actually an improvement, but it may be slightly less convenient.
Che Frenz
Greenhorn

Joined: Dec 15, 2008
Posts: 14
Cool. Thanks for the response!
Che Frenz
Greenhorn

Joined: Dec 15, 2008
Posts: 14
Me again. Dumb question - how do I check for errors? New to Struts 2 (obviously) and not sure how to format s:if to check for errors. Any suggestions are greatly appreciated!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If your action extends ActionSupport (awfully convenient) then you have access to all its methods via OGNL, including hasActionErrors(), hasActionMessages(), and hasFieldErrors().
Che Frenz
Greenhorn

Joined: Dec 15, 2008
Posts: 14
Perfect! Thanks again!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: errors.header in struts2
 
Similar Threads
Struts2
addActionError in struts2
Struts2 namespace url problem
Struts2 Annotations
struts2 out of the box problem