This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Struts and the fly likes Problem With I18n feature of Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem With I18n feature of Struts2" Watch "Problem With I18n feature of Struts2" New topic
Author

Problem With I18n feature of Struts2

jainitya jaiyswal
Greenhorn

Joined: Mar 28, 2011
Posts: 10
Hi I am trying to create an application with hindi fonts (Only Lable required to be shown in hindi)with the help of Struts2 i18n feature.
I have cretaed required properties file as global_hi.properties
for the label username ,password and submit button.
It works fine for submit button,but for password its showing *??? .
I have attached my jsp ,struts.xml and proerties fiel.
struts.xml is

My jsp file it have

and in properties file


Tanks in advance

candid java
Greenhorn

Joined: Jan 13, 2012
Posts: 14
You should configure the Browser settings properly this link will clarify your needs http://candidjava.com/struts-1x-i18n-internationalization-with-example-program-in-eclipse
jainitya jaiyswal
Greenhorn

Joined: Mar 28, 2011
Posts: 10
hi

Thanks for your quick reply,
I am looking in to the link you have given but it does not help,link says nothing about struts 1x i18n internationalization with example program In Eclipse ,it just have some related article links,
could you please be more specific about the link

Thanks
jainitya
Srinivasa Rao Ammina
Greenhorn

Joined: Jan 24, 2012
Posts: 20
Could you please elaborate what is the exact issues you are facing here?
jainitya jaiyswal
Greenhorn

Joined: Mar 28, 2011
Posts: 10
hi
Trying to implement i18n feature of struts2 for language hindi.
Porpeties file, struts file, and jsp updated,

working fine for submit button but for label it showing as *???.

Please help.
thanks


[Thumbnail for lsms.png]

Srinivasa Rao Ammina
Greenhorn

Joined: Jan 24, 2012
Posts: 20
I doubt with the name attribute

<s:textfield required="true" requiredposition="left" maxLength="25" key="global.username" name="userMaster.loginid" />
<s:password required="true" requiredposition="left" maxLength="8" key="global.passwordd" name="userMaster.Password" />

For the above lines of code, please remove the name attributes and try it once. Then also if doesn't work just give the names as loginid and Password

jainitya jaiyswal
Greenhorn

Joined: Mar 28, 2011
Posts: 10
jsp updated as


and then


but no success.
jainitya jaiyswal
Greenhorn

Joined: Mar 28, 2011
Posts: 10
Hi I have solved the problem.
The problem is => I am using the tiles plugin in struts 2
and in BaseLayout page,I have


this line is creating the problem
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
after removing the line it works just fine

Although I did not get any reason for this but this trick just work for me,I have got this solution from this link
http://www.mkyong.com/struts2/struts-2-chinese-localization-issue/

Thanks
Srinivasa Rao Ammina
Greenhorn

Joined: Jan 24, 2012
Posts: 20
Good. I am also facing similar kind of issues. Could you please check and let us know do you have any idea about this.

In the french related property file of yours could you please add this \u00e8 at the end of global.submit property ? basically this related a character in french (é)

And click on the submit button and check whether application is loggin correctly or not?

Since if the property files contains the special charters like (é) it is throwing missing resource '<key value'> in key method map

Could you please check this once from u'r end and let us know about this. Since we are not using struts2.0 version

Thanks
jainitya jaiyswal
Greenhorn

Joined: Mar 28, 2011
Posts: 10
hi Srinivasa
I have tested this and it works fine,After submitting I am able to login in the application
global_fr.properties




[Thumbnail for login.png]

Srinivasa Rao Ammina
Greenhorn

Joined: Jan 24, 2012
Posts: 20
Hi jainitya,

Thank you for the confirmation. Then there is some issue with my code. We will check the same.
Thanks again for the help.

Srini
jainitya jaiyswal
Greenhorn

Joined: Mar 28, 2011
Posts: 10
Hi just want to tell you that this link
http://www.mkyong.com/struts2/struts-2-chinese-localization-issue/
says
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
In Struts 1, the above meta tag is required to display the UTF-8 data correctly, but this is not true for Struts 2.
Please check if this help.

thanks
Jainitya
Srinivasa Rao Ammina
Greenhorn

Joined: Jan 24, 2012
Posts: 20
Hi jainitya,

Tried with that option also but no luck. Here the issue is, in the jsp's it is showing the correct values either in english or in frensh but after submitting the form internally
it is checking the method name and there is is interpretting diffrently.

For more info you can check the posting of the issue @

http://www.coderanch.com/t/565389/Struts/Internationalization-special-French-characters

Srini
Srinivasa Rao Ammina
Greenhorn

Joined: Jan 24, 2012
Posts: 20
Hi

Got the solution

The following lines in the jsp pags causes the issues

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

If we remove these line it is working fine.

Thanks
Srini
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem With I18n feature of Struts2
 
Similar Threads
Localization with Struts2 help, not persisting to any other pages
Struts 2 - i18n Chinese localization issue
validation problem.
struts2 properties file reload
Struts 2 i18n problem