Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem using bean message bean:message  RSS feed

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i am using LookupDispath Action in my struts app.

the multiple submit buttons in my jsp are:

<html:form action="/Admin">
<table height="300">
<tr>
<td>
<html:submit property="method" >
<bean:message key="button.changeOwner" />
</html:submit>
</td>
<td>
<html:submit property="method" >
<bean:message key="button.newRG"/>
</html:submit>
</td>
</tr>
</table>
</html:form>

the entries in ApplicationResources File are :

button.changeOwner=Change Owner
button.newRG=New Report Group

the key Method Map is :

protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("button.changeOwner", "ChangeOwner");
map.put("button.newRG", "NewRG");
return map;
}

The Problem is that i am getting :

???en_US.button.changeOwner???
and
???en_US.button.newRG???

as my button labels.

when i try to use the "value" attribute of "submit" button and change the key method map as :

protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("Change Owner", "ChangeOwner");
map.put("button.newRG", "NewRG");
return map;
}


the button labels are fine but i get the error as :

javax.servlet.ServletException: Action[/Admin] missing resource 'Change Owner' in key method map

Please help me to get the button labels right without the exception.

thanks
sameer
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question marks are an indication that Struts can't find your resources file. Verify that you have an entry similar to:

<message-resources parameter="com.mycompany.resources.ApplicationResources"/>

in your struts-config.xml file, and that the package and file are in your WEB_INF/classes directory.
 
sameer kumar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx a lot merrill, my problem has been resolved.

the actual problem was that i had given the complete path as

<message-resources parameter="/WEB-INF/classes/ApplicationResources"/>

when i changed it to

<message-resources parameter="/ApplicationResources"/>

it worked.

thanx
sameer
 
this is supposed to be a surprise, but it smells like a tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!