This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Struts and the fly likes Can't get error messages to display Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Can Watch "Can New topic

Can't get error messages to display

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Hi, In my Struts application, I have my validateForm method in my ActionForm

public ActionErrors validate(
ActionMapping mapping, HttpServletRequest request ) {
final ActionErrors errors = new ActionErrors();
ActionMessage am = new ActionMessage("error.accountNum.invalid");
logger.debug("Validation failure:" + am.toString());

and then on my JSP page I have


However even though my validation form is setting values in the ActionErrors object (which I verify through my log file), those errors are displayed in the JSP. Any ideas what I'm doing wrong?

Thanks, - Dave
David Newton

Joined: Sep 29, 2008
Posts: 12617

Are you calling validation manually? If so you need to save the errors to the request.
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
I am not calling it manually. I put the ActionErrors validate method to my ActionForm and have this in my struts-config.xml file

<form-bean name="REAccountLookUpBean" type="com.myco.regui.struts.accounts.AccountsForm" />

<action path="/pcFlow"

The method is getting called just fine and the ActionErrors object is getting set but nothing is displayed for "<html:errors></html:errors>". Why not?

- Dave
I agree. Here's the link:
subject: Can't get error messages to display
It's not a secret anymore!