I started working a new assignment of Struts based maintenance J2EE project.
I am new to Struts and having some trouble understanding the code and I seek
Struts expers help here .

Basically we need to add Internationalization support to the existing Struts
based code and here I am trying to show Japanese characters in the browser.



my jsp code looks like below:
------------------------------------------

....
<%@ taglib uri="/WEB-INF/tld/globaltech-formatter.tld" prefix="fmt" %>
...
<div class="tabBody">
<table class="impact2form" cellpadding="0" cellspacing="2">
<tr class="tableRowOdd">
<td  colspan = 2><bean:message bundle="customer"
key="customer.calcs.payoff"/></td>
</tr>
<tr>
<th><fmt:message bundle="customer" metaDataRef="loanAmount"/></th>
<td><html:text property="loanAmount" maxlength="10" size="10" tabindex="10"
/></td>
</tr>
....
....






globaltech-formatter.tld
---------------------------------
....
....
<tag>
<name>message</name>
<tagclass>com.globaltech.web.taglib.message.MessageTag</tagclass>
<bodycontent>empty</bodycontent>
<attribute>
<name>arg0</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>arg1</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>arg2</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>arg3</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>arg4</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>bundle</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>key</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>locale</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>property</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>metaDataRef</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
...
...





struts-customer.xml
-----------------------------

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.1//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>

<struts-config>
.....
.....
<message-resources key="customer"
 parameter="com.globaltech.customer.CustomerResources"/>
   ....
</struts-config>





What I did ?
-------------------

1.
I started creating a new file using the Notepad editor on Windows XP . The
file is then saved as type "Unicode Big Endian"
Next, using the native2ascii utility from JDK 1.4 SDK, I use the following
command to convert this file to an ASCII file:
native2ascii -encoding UnicodeBig CustomerResources_zh.ucd
CustomerResources_zh.properties
The resulting output CustomerResources_zh.properties contains the required
escape code.
I am using this file CustomerResources_zh.properties in my web project.

2.
In my internet explorer, Tools --> Internet Options --> Languages tab, I
added the language "Chinese (Hong Kong S.A.R.) [zh-HK]"


3.
When I fire a request to my jsp, I see garbage character in my browser
instead of chinese characters.
I tried to even add this line
<%@ page contentType="text/html; charset=utf-8" %>
to top of my jsp file but still no use.






Can you please clarify what I am missing here and how to add i18n support
for Chinese locale to my existing Struts based code ?

Reply via email to