The problem is that if I want to display the error in a Javascript 'alert'
box
I don't want the html header and footer, I just want the message.

The problem with this is to get the error text *only*. The only way I've
found is
to use

String error = RequestUtils.message(pageContext,
                                    "org.apache.struts.action.MESSAGE",
                                    "org.apache.struts.action.LOCALE",
                                    "errors.login.detailsInvalid");

That works fine in a jsp but I don't want this logic in my jsp and
I can't access pageContext from within the Action.

Does anyone know how to get the error text (access application.properties)
from within an Action.

Thanks for your help,
Markus

-----Original Message-----
From: edgar [mailto:edgar@;blue-moose.net]
Sent: Friday, November 15, 2002 1:32 PM
To: 'Struts Users Mailing List'
Subject: RE: How to access ActionErrors from within FormAction


Why is this an issue?  Just to put any error.header or error.footer in
the properties file.

If you must, the following will get you the list of errors:

         ActionErrors ae = (ActionErrors)
request.getAttribute(Action.ERROR_KEY);

Edgar

-----Original Message-----
From: Markus Pedratscher (WebBS) [mailto:markp@;webbs.tv]
Sent: Friday, November 15, 2002 5:56 AM
To: '[EMAIL PROTECTED]'
Subject: How to access ActionErrors from within FormAction


Hi,
I'm fairly new to struts and I'm having the following problem.

I want to display an error message in an js alert box. My understanding
is that I can't do that with </errors> because if wraps the error.header
and .error.footer around each message and does not have an attribute to
disable this behavior.

Therefore what I want to do is to get the message from
application.properties and then store it in the form bean. The problem
is that I can't figure out which class/method to use to read the message
from application.properties (from within my formAction). I'm looking for
something like this:

String messageText = messageContext.getMessage(messageKey);

Can anyone help?
Thanks
Markus


--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>


--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>




--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to