• Post Reply Bookmark Topic Watch Topic
  • New Topic

Internationalization of Struts program  RSS feed

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i am planning to have different messages picked up from the aplication resouces properties file but it doesn't seem to work The ApplicationResources.properties file resides in my classes->com folder and there is an entry for this key as
app.title=CRS
but this <bean:message key="app.title" /> doesn't work.
The same happens to display an error besides html component
if the user name is empty then i add error as
errors.add("userID", new ActionError("error.userID.required"))
as per the book i have an entry for error.userID.required in teh resource file as
error.userID.required=<li>User ID cant be null</li>
and i try to print the error as <html:errors property="userID"/>

Lastly i have defined the mapping for the application resource file in the strutsconfig.xml as
<message-resources parameter="com.ApplicationResources" />
Any help will be appreciated
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you add
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
in your jsp?
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, i did have the tag lib decleration at the beginning of the page
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello. I am still unable to display the value from the application resources file. just dont know what's wrong with this. the only thing i get is some string like ???en_US.app.title??? . Can anyone help with this
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you added the ApplicationResources.properties file to the controller servlet in the web.xml file. as init-param
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!