You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ciaran Hanley <ci...@sentenial.ie> on 2004/03/18 18:14:09 UTC
Dynamic Messages
Hey,
Can ActionMessages/ActionErrors be created dynamically or do they always
need to read from a resource file.
I would like a more meaningful message shown when something is added to the
DB, like instead of "Client successfully added" I would like "Joe Bloggs
details have been added". Can this be done using these classes?
Thanks
RE: Dynamic Messages
Posted by Wiebe de Jong <wi...@shaw.ca>.
Messages from your resource file can have parameters.
Resource file:
user.added={0} successfully added
Action:
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("user.added", bean.name));
messages.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("user.added", bean.name));
You could have as many parameters as you want. For example:
detail.line={0} of {1} was added on {2}
-----Original Message-----
From: Ciaran Hanley [mailto:ciaran.hanley@sentenial.ie]
Sent: Thursday, March 18, 2004 9:14 AM
To: Struts User Mailing List
Subject: Dynamic Messages
Hey,
Can ActionMessages/ActionErrors be created dynamically or do they always
need to read from a resource file.
I would like a more meaningful message shown when something is added to the
DB, like instead of "Client successfully added" I would like "Joe Bloggs
details have been added". Can this be done using these classes?
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org