aspose file tools*
The moose likes Struts and the fly likes problem in internationalization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem in internationalization" Watch "problem in internationalization" New topic
Author

problem in internationalization

Naresh Gunda
Ranch Hand

Joined: Oct 15, 2005
Posts: 163
Hi Ranchers, i am getting the following error message- pls help me to correct my application.

javax.servlet.ServletException: Missing message for key "language"

Login.jsp
-----------
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html>
<body>
<html:form action="login.do" >
<bean:message key="language" />
<pre>
<bean:message key="username" /><html:text property="uid" />
<bean:message key="password" /><html assword property="pwd"/>
<html:submit>
<bean:message key="submit" />
</html:submit>
</pre>
</html:form>
</body>
</html:html>

--------------------------------------------------
Welcome.jsp
---------------------------------------------
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html>
<body>
<bean:message key="language" />
<bean:message key="welcome" />
<bean:write name="loginform" property="uid" />
</body>
</html>
-------------------------------------
LoginAction.java
-------------------------------------
import org.apache.struts.action.*;
import javax.servlet.http.*;
public class LoginAction extends Action
{
public ActionForward execute(ActionMapping an,ActionForm af, HttpServletRequest req,HttpServletResponse res) throws Exception
{

return an.findForward("welcome");

}//execute
}
---------------------------------------------
LoginForm.java
---------------------------------------------
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class LoginForm extends ActionForm
{

private String uid,pwd;

public void setUid(String uid)
{
this.uid=uid;
}

public String getUid()
{
return uid;
}
public void setPwd(String pwd)
{
this.pwd=pwd;
}
public String getPwd()
{
return pwd;
}

public void reset(ActionMapping mapping, HttpServletRequest req)
{
this.uid=null;
this.pwd=null;
}

}

---------------------------------
ApplicationResources_it_IT.properties
-----------------------------------
username = User Name
password = Parola d'accesso
submit = Presenti
welcome= Benvenuto
language=Italian

---------------------------------
struts-config.xml
----------------------------------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC

"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" " http://struts.apache.org/dtds/struts-config_1_2.dtd">


<struts-config>
<action-mappings>
<action path="/login" name="loginform" type="LoginAction">
</action>
</action-mappings>

<form-beans>
<form-bean name="loginform" type="LoginForm">
</form-bean>
</form-beans>

<global-forwards>
<forward name="welcome" path="/Welcome.jsp" />
</global-forwards>

<message-resources parameter="ApplicationResources" />

</struts-config>
-------------------------------------------
web.xml
--------------------------------------------
<web-app>

<servlet>
<servlet-name>as</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>

<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>


<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>as</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>



<welcome-file-list>
<welcome-file>Login.jsp</welcome-file>
</welcome-file-list>

<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>




<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

</web-app>



I am using Internetexploer. I have changed language settings like..
tools->options->(general)Lanuges i have selected Italian(it) and i removed all other entries.


Can any one of u tell me what is wrong with my application?
Thanx in advance
Naresh Gunda
Ranch Hand

Joined: Oct 15, 2005
Posts: 163
ranchers pls respond.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You haven't told us where you put your ApplicationResources_it_IT.properties file. Make sure it is in WEB-INF/classes.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in internationalization