File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes actionmessages problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "actionmessages problem" Watch "actionmessages problem" New topic
Author

actionmessages problem

azhar bharat
Ranch Hand

Joined: Jul 17, 2006
Posts: 87
Hi

I am having problem displaying the errors from my action form.

Action Code:

JSP page code

I dont know what I am doing wrong, but the error message is never shown.

Further down, i have another piece of code which is to show a message when all operations complete succesfully.
Action Servlet code:


This code works perfectly, and the message is displayed.

Further more, the error messsages are saved in the session, but somehow not displayed. I am sure of this because, after the conditions are met and the failure page is displayed, If I take any other page which contains "html:messages" tag, this message is shown in that page.

So, what could be the problem>?
poornima balagopal
Ranch Hand

Joined: Dec 02, 2003
Posts: 83
Hi
Can you just try by adding the following tag in your jsp page?

<html:errors/>
This tag is used to access and present the results of Struts' data validation. Errors detected by other portions of the framework are accessible to the View component via this tag.

Mean while you can go through this link also.
http://forum.java.sun.com/thread.jspa?threadID=476429&messageID=2212084
azhar bharat
Ranch Hand

Joined: Jul 17, 2006
Posts: 87
tried <html:errors />
does not work.
poornima balagopal
Ranch Hand

Joined: Dec 02, 2003
Posts: 83
Which version of struts you are using? check out the following code. Hope this may help you.
catch(Exception e) {
ActionMessages actionMessages = new ActionMessages();
actionMessages.add("Customers.update", new ActionMessage("errors.update", e.getClass().getName()
+ ": " + e.getMessage()));

saveErrors(request, actionMessages);

return mapping.findForward("failure");
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: actionmessages problem