This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes Struts and the fly likes problem with action message. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem with action message." Watch "problem with action message." New topic

problem with action message.

prashant kond

Joined: Mar 03, 2005
Posts: 18
I am using action messages in my jsp. while displaying it is adding extra charecters. If any one having idea please let me know.

My requirement to display only "AA-JDBC Name already exists."
but it is displaying in this way as action message.

???en_US.AA-JDBC Name already exists.???

my jsp code is:
<td valign="top">
<div id="messageTable" style="display:none">
<table width="100%" class="ADPUI-messageError">
<logic:messagesPresent message="true">
<td style="padding-left:30px">
<html:messages id="msg" message="true">
<bean:write name="msg"/>
</html:messages> </td>
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The problem is not in your JSP code, but in the code that creates the ActionMessage. An ActionMessage is intended to be populated by a message key that exists in the file. It is not intended to be populated by a literal string as you are apparently doing. Try adding the following to your file (or whatever message resource file is defined in your struts-config.xml file)

and changing the code that creates the message so it looks something like this:

After telling you all this, if you really prefer not to have your messages in the file, you can specify a literal when creating a message like this:

The second parameter tells struts this is a literal message, and not a message key.

See this link for more information on Struts messages.
[ February 22, 2007: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
prashant kond

Joined: Mar 03, 2005
Posts: 18
thanks for detailed solution. sorry for late reply.
I agree. Here's the link:
subject: problem with action message.
It's not a secret anymore!