struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Samere, Adam J" <>
Subject RE: Validating in Action?
Date Thu, 01 Jun 2006 15:42:37 GMT
You can use the ActionMessage constructor that takes a string and a
boolean indicating whether or not the string is a key to be looked up in
a resource bundle. By setting this to false, the string is taken as a

public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response){
	  String myMessage = ...; // app logic that returns a string

   	  ActionMessages errors = new ActionMessages();

	  // use GLOBAL_MESSAGE if message does not pertain to a
specific property
        errors.add(ActionMessages.GLOBAL_MESSAGE, new
ActionMessage(myMessage, false));
        saveErrors(request, errors);
-----Original Message-----
From: marcus biel (innoWake gmbh) [] 
Sent: Thursday, June 01, 2006 10:50 AM
To: Struts Users Mailing List
Subject: Validating in Action?


I got a JSP, form and Action.
I want to add 3 values into an database.
This is done in my action.
The problem: I am using a Service to add the stuff to the db, and when
using this service, it throws error messages like "artikel not found" or
"project not found".
Now I want to display these errors to the user -

The problem is I can't do those error validation in my ActionForm,
because only after doing the action I will know wether or not it
succeeded - so how can I then set the appropiate errormessages and
forward to the jsp?



To unsubscribe, e-mail:
For additional commands, e-mail:

The information contained in this message may be privileged,
confidential, and protected from disclosure. If the reader of this
message is not the intended recipient, or any employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution, or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately
by replying to the message and deleting it from your computer.

Thank you. Paychex, Inc.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message