HI all
Can some one help me in solving the follwoing problem. I am developing an
internationalization tag. I have two tags(main tag and message tag). Messag
tag is to retrive the message form a .properties file.
main tag has attributes lang and country, this will create the Locale
object. The message tag is an inner tag. will take the locale object from
the main tag and will retrive the message.
I have the following lines of code in my jsp.
<i18n:main language="ja" country="JP">
<i18n:message baseName="loginbundle" key="prompt"/>
</i18n:main>
<i18n:main language="fr" country="FR">
<i18n:message baseName="loginbundle" key="user"/>
</i18n:main>
I am setting the locale inside the main tag's doStartTag() method .
HttpServletResponse response = null;
response = (HttpServletResponse)pageContext.getResponse();
response.setLocale(locale);
During the display I can see the values for French only. The japanese values
are displayed in the form of '?' marks.
If I use the following code only in my JSP
<i18n:main language="ja" country="JP">
<i18n:message baseName="loginbundle" key="prompt"/>
</i18n:main>
The Japanese characters are displayed properly, the output is perfect.
If I use the following code in my JSP, the ouput is perfect .
<%
Locale locale1 = new Locale("fr", "FR");
ResourceBundle bundleObject1 =
ResourceBundle.getBundle("loginbundle", locale1);
response.setLocale(locale1);
out.println(bundleObject1.getString("user"));
%>
<br>
<hr>
<%
Locale locale = new Locale("ja", "JP");
ResourceBundle bundleObject =
ResourceBundle.getBundle("loginbundle", locale);
response.setLocale(locale);
out.println(bundleObject.getString("greeting"));
%>
Can any one tell me what the exactt problem is when I use the Tag.
Regards,
Harry.
This e-mail and any files transmitted with it are for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and
destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing or
copying of this email or any action taken in reliance on this e-mail is strictly
prohibited and may be unlawful.
Visit us at http://www.cognizant.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets