struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Shneyderman" <a...@law.columbia.edu>
Subject RE: Action Errors?
Date Mon, 30 Jun 2003 16:07:03 GMT


> -----Original Message-----
> From: Kevin.Niekamp@crown.com [mailto:Kevin.Niekamp@crown.com]
> Sent: Monday, June 30, 2003 9:19 AM
> To: struts-user@jakarta.apache.org
> Subject: Action Errors?
> 
> Hi,
> 
> Is there anyway to dynamically pass in a Action Error instead of
always
> having to pass in something from a Resource File (see code below)?
Also,

You can use parametrized ActionErrors 
ActionError (mskKey, <list of upto four params>);

This way your message will look like
msgKey=Missing account city for line number {0}

Now in your code you would do something like
errors.add(ActionErrors.GLOBAL_ERROR, 
    new ActionError("msgKey", <your parameter that will be palced in
stead of {0}>));

If you want to generate your custom messages from within your code then
you basically are killing the idea of all the messages in the central
place and the ease of internationalizing your app, but you can still do
it. Exactly the same way. Just create a custom message in your
Application.resources (or whatever your name might be) file and use the
same construct for ActionError as shown above.

Alex.



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


Mime
View raw message