It is my understanding that you cannot dynamically set the locale of a jsp
response. It depends on the charset set in the page directive:
<%@ page contentType="text/html;charset=ISO-8859-1" %>
(This is the default content type, which is used if nothing is declared.)
Can anyone confirm this? I hope that I am wrong. If not, I believe a
work-around may be to set the charset to UTF-8 (unicode), but I haven't
tried that yet.
-----Original Message-----
From: Albert Wong [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 21, 2000 12:33 AM
To: [EMAIL PROTECTED]
Subject: Using ServletResponse.setLocale in JSP (internationlization)
Hi
The "ServletResponse.setLocale" method looks pretty useful: it configures
the PrintWriter to the appropriate character set, set's the content type and
content language headers. It's especially appealing because one can
retrieve the "Locale" from ServletRequest.getLocale and use that object in
the ServletResponse (eg.servletResponse.setLocale(localFromRequest)).
The problem, in the case of JSP, is the following:
According to the JavaDoc on "ServletResponse" the "setLocale" method should
be called BEFORE "getWriter". How would I use this method given the servlet
generated from my JSP has already grabbed the "Writer" by the time any
scriplet or JSP tag/directive I have can be executed?
Thanks,
Albert
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
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
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
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