Thanks for the help!! I knew there had to be a way to do this, but sometimes I guess it takes some help to get pointed in the right direction! :)

I also found that if you're trying to add ActionErrors in Action.execute() this works too...

errors.add("msg.errors", new ActionErrors("no.idiot.do.this", myIdiotParamArray));

Thanks again!
L:)

Lukas Bradley wrote:

Linda, et al,

Now that I've had a moment to review the code, I understand that the
ActionMessage/ActionError is just an encapsulation of the key/replacement
values for a resource message.  It is not until this information is rendered
that the bundle is specified.

For example, the <html:errors> tag allows a "bundle" attribute to be used.
It is within this tag that the bundle attribute is used to look up the
message contents (using org.apache.struts.util.RequestUtils), replace the
values as specified, and render the results to the user.

Therefore, if you (1) define your error bundle as such within your
struts-config.xml,
<message-resources parameter="MyErrors" key="msg.errors" null="false" />

(2) add an error within you code like so,

ActionError oneError = new ActionError("no.idiot.do.this",
myIdiotParamArray) ;

and (3) utilize the same bundle name as in step 1,

<html:errors bundle="msg.errors" />

Everything will work fine.

If you want the message within your Action itself, check out the
RequestUtils.message() method.

Lukas


"Linda Coleman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]


Did you ever get a reply to this? I'm having the same problem & was
wondering if you ever got this work.

It seems odd that you can get the messages from bean:write but not in
the Action.

TIA!
L:)

Lukas Bradley wrote:



Hi all,

Is there any way to have an ActionMessage key/value pair defined in a
non-default resource?

<message-resources parameter="MyTerms" key="myterms" null="false"/>

The default seems to be the only place my errors and messages can be


found.


Using the above example, how would I refer to a property within that
resource when creating an ActionMessage?

ActionMessage myMessage = new ActionMessage("this.key.isnt.found") ;

????

Lukas




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












Reply via email to