Thanks Jan for your detailed explanation. I think I finally find the right document 
which is under the standard-doc of the 
taglib. 

1)
I follow the instruction and insert the line:
<%@ taglib uri="http://java.sun.com/jstl/ea/fmt"; prefix="fmt" %>
in a JSP file, and the lines:

        <context-param> 
                <param-name>javax.servlet.jsp.jstl.i18n.basename</param-name>   
                <param-value>mm</param-value>   
        </context-param>   
in the web.xml file.

I also have three resource files in place: mm.properties, mm_en.properties, and 
mm_zh.properties.

I get an exception when I try to bring up the jsp page (see the error message on the 
bottom).

After I replace the format tag lib of JSTL with the followings:

<%@ taglib uri="http://jakarta.apache.org/taglibs/i18n-1.0"; prefix="i18n" %>

<i18n:bundle baseName="mm"
             id="bundle"/>

The English version displays properly under the browser language setting with ?en? 
higher than ?zh?.

To my understanding, the code base of i18n and fmt tag libraries are the same (You 
wrote it). I guess the problem is the 
setting. Would you please point out where I did wrong.

2)
When 'zh' is higher than 'en' in the browser's language setting, all messages in the 
resource file are displayed as ???. 
And I find out the locale and character setting on the page is en_US and ISP-8859-1 
respectively. All jsp files have the 
character set as UTF-8 since each jsp file started with <%@ page 
contentType='text/html; charset=UTF-8' %>. All JSP 
file is formed from several regions: banner, side bar, footer, and body.

How can I have the right locale and character set in the JSP file?

Thanks very much for your kindly help.

Vernon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2002-05-22 04:41:41 ApplicationDispatcher[/mm] Servlet.service() for servlet jsp threw 
exception
javax.servlet.ServletException: org/mozilla/javascript/JavaScriptException
        at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:463)
        at org.apache.jsp.content$jsp._jspService(content$jsp.java:346)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:683)
        at 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
        at 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:819)
        at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:391)
        at com.vernonwu.waf.view.template.Section.render(Section.java:41)
        at com.vernonwu.waf.view.template.tags.RenderTag.doEndTag(RenderTag.java:57)
        at org.apache.jsp.hscf02$jsp._jspService(hscf02$jsp.java:137)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:683)
        at 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
        at 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:819)
        at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:391)
        at com.vernonwu.waf.view.template.Region.render(Region.java:35)
        at com.vernonwu.waf.view.template.tags.RenderTag.doEndTag(RenderTag.java:61)
        at org.apache.jsp.page$jsp._jspService(page$jsp.java:1480)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at 
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1017)
        at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1115)
        at java.lang.Thread.run(Thread.java:536)
----- Root Cause -----
java.lang.NoClassDefFoundError: org/mozilla/javascript/JavaScriptException
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:130)
        at 
org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.getEvaluatorByName
(ExpressionEvaluatorManager.java:219)
        at org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate
(ExpressionEvaluatorManager.java:183)
        at 
org.apache.taglibs.standard.tag.el.core.ExpressionUtil.evalNotNull(ExpressionUtil.java:85)
        at 
org.apache.taglibs.standard.tag.el.fmt.MessageTag.evaluateExpressions(MessageTag.java:159)
        at 
org.apache.taglibs.standard.tag.el.fmt.MessageTag.doStartTag(MessageTag.java:108)
        at org.apache.jsp.content$jsp._jspService(content$jsp.java:192)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:683)
        at 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
        at 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:819)
        at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:391)
        at com.vernonwu.waf.view.template.Section.render(Section.java:41)
        at com.vernonwu.waf.view.template.tags.RenderTag.doEndTag(RenderTag.java:57)
        at org.apache.jsp.hscf02$jsp._jspService(hscf02$jsp.java:137)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:683)
        at 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
        at 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:819)
        at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:391)
        at com.vernonwu.waf.view.template.Region.render(Region.java:35)
        at com.vernonwu.waf.view.template.tags.RenderTag.doEndTag(RenderTag.java:61)
        at org.apache.jsp.page$jsp._jspService(page$jsp.java:1480)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at 
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1017)
        at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1115)
        at java.lang.Thread.run(Thread.java:536)

5/18/2002 5:57:35 AM, Jan Luehe <[EMAIL PROTECTED]> wrote:

>Vernon:
>
>> To my understanding, when I use the i18n tags from JSTL, I don't
>> need to write any class to get locale information stored. Only task
>> is to configure the locale information file. Please point it out if
>> I am wrong.  If I need to use the PropertyResourceBundle class as
>> the followings (this class, according to the JDK document, can't be
>> subclassed by the way):
>
>I never suggested you subclass PropertyResourceBundle. I said that
>JSTL's I18N tags work with any subclass of java.util.ResourceBundle,
>and the JDK happens to provide two subclasses: ListResourceBundle and
>PropertyResourceBundle. I mentioned that only in the unlikely case
>that neither of these fit your needs would you have to provide your
>own subclass of ResourceBundle (not PropertyResourceBundle).
>
>When using PropertyResourceBundle, all you need to provide is a
>properties file containing key/value pairs. PropertyResourceBundle has
>a constructor which takes an InputStream from which the properties
>file is read.
>
>For example, if you had this JSP fragment:
>
>  <fmt:setLocale value="en-US" />
>  <fmt:setBundle basename="com.acme.resources.Resources" />
>  <fmt:message key="greeting" />
>
>you would need to provide the following resource with your web application:
>
>  com/acme/resources/Resources_en_US.properties
>
>with these contents:
>
>  greeting=Hi
>
>You can also take a look at the standard-examples web application that
>ships with the JSTL reference implementation. It contains example
>pages that have been internationalized into German and Italian, and bundles
>the corresponding properties files containing the German and Italian
>localized messages.
>
>> At this point, I am very frustrated by the fact of lacking JSTL
>> documentation. I have searched all possible places and not much
>> helpful information available. The document comes with JSTL doesn't
>> help much. And the jwsdp document mentions JSTL, but still not much
>> on i18n. I guess that I shall use i18n tags other than
>> JSTL.
>
>Please note that JSTL leverages the I18N support provided by the JDK.
>on which there is a good tutorial at:
>
>  http://java.sun.com/docs/books/tutorial/i18n/
>
>Also, 3 books (that I am aware of) covering JSTL will be out shortly.
>
>
>Jan
>
>
>
>




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to