step 1) in your action's execute method....

ActionErrors errors = new ActionErrors();

errors.add("userHasFooProblem",new ActionError("message.key"));
//message.key must be in resource bundle, e.g., application.properties

this.saveErrors(errors);

return mapping.findForward("failure");



step 2) then in your jsp......


<html:messages property="userHasForProblems" />


(I did this off the top of my head so if the syntax is wrong opps... it
should be close).

Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring


-----Original Message-----
From: bort [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 06, 2004 11:48 AM
To: [EMAIL PROTECTED]
Subject: Displaying messages as a result of failure


Hi all

How do I present, to the user, customized messages in the case of an Action
failure?  For example, say a user fills and submits a form.  The form gets
validated, and control is passed onto the Action.  From within the action,
we have a "success" and "failure" forward.  In the case of a "failure", I
forward the user back to the same page.  What I'd like to do now, however,
is to print out a customized message on this page, explaining what the
problem was.

I realize that this is a rather simple question... so please go easy on me!

TIA
bort




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to