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
literal.

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) [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 01, 2006 10:50 AM
To: Struts Users Mailing List
Subject: Validating in Action?

Hi,

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?


Thanks,

Marcus 


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


-----------------------------------------
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to