Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

errors.header in struts2

 
Che Frenz
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool. Thanks for the response!
 
Che Frenz
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perfect! Thanks again!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic