You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Dima Gutzeit <di...@mailvision.net> on 2004/01/26 16:27:45 UTC

FMT question

Dear list members ,

I am using to FMT taglibrary for localization of my webapp.
Whe defining the locale in the web.xml file everything works just fine but I can not change the locale of default bundle on the fly.

Doing this :

<fmt:setLocale value="en_US" scope="session"/>

does not help. Can anyone point me in the right direction ?


Regards , 
Dima Gutzeit.
---------------------------------
MailVision LTD. 
R&D Team. 
Phone: 972-4-8500505 ext. 14 
Fax: 972 - 4 - 8508000 
http://www.mailvision.com 



Re: FMT question

Posted by Kris Schneider <kr...@dotech.com>.
I'm still not clear why you're having problems. Here's another small test that
seemed to work:

redir.jsp:

<%@ taglib prefix="c"   uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<fmt:setLocale value="fr" scope="session"/>
<c:redirect url="/msg.jsp"/>

msg.jsp:

<%@ page contentType="text/plain" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
msg: <fmt:message key="msg"/>

So if you hit redir.jsp, you get redirected to msg.jsp which outputs:

msg: fr

Is this essentially what you're trying to do?

Quoting Dima Gutzeit <di...@mailvision.net>:

> Here is the summary of the behaviour on my side :
> 
> On the first page of the application everything works great. Problem starts
> when I <c:redirect> to another JSP page in the application.
> 
> On this new page , the application totaly "forget" what locale has been set
> nad takes the settings from web.xml
> 
> Both pages are in the same application , sharing the same session.
> 
> Anyone has ideas ?
> 
> ----- Original Message ----- 
> From: "Kris Schneider" <kr...@dotech.com>
> To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
> Sent: Monday, January 26, 2004 7:16 PM
> Subject: Re: FMT question
> 
> 
> > It seems to work for me. Here's my setup:
> >
> > /WEB-INF/classes/Messages.properties (msg=root)
> > /WEB-INF/classes/Messages_en_US.properties (msg=en_US)
> > /WEB-INF/classes/Messages_fr.properties.properties (msg=fr)
> >
> > web.xml:
> >
> > <context-param>
> >   <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
> >   <param-value>Messages</param-value>
> > </context-param>
> >
> > If my JSP just has this:
> >
> > msg: <fmt:message key="msg"/>
> >
> > It produces:
> >
> > msg: root
> >
> > If I change the JSP to:
> >
> > <fmt:setLocale value="fr" scope="session"/>
> > msg: <fmt:message key="msg"/>
> >
> > It produces:
> >
> > msg: fr
> >
> > Quoting Dima Gutzeit <di...@mailvision.net>:
> >
> > > I have bundle_en_US as well as bundle_ru_RU. I can not "switch" the fmt
> to
> > > use another locale file during the runtime while changing it in web.xml
> :
> > >
> > > <context-param>
> > >                 <param-name>
> > >                  javax.servlet.jsp.jstl.fmt.locale
> > >                 </param-name>
> > >                 <param-value>
> > >                 en_US
> > >         </param-value>
> > >
> > > and restarting the app works fine.
> > >
> > > ----- Original Message ----- 
> > > From: "Kris Schneider" <kr...@dotech.com>
> > > To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
> > > Sent: Monday, January 26, 2004 6:27 PM
> > > Subject: Re: FMT question
> > >
> > >
> > > > What property files (resource bundles) are available in your app? Do
> you
> > > have
> > > > either a bundle_en.properties or a bundle_en_US.properties file?
> > > >
> > > > Quoting Dima Gutzeit <di...@mailvision.net>:
> > > >
> > > > > Dear list members ,
> > > > >
> > > > > I am using to FMT taglibrary for localization of my webapp.
> > > > > Whe defining the locale in the web.xml file everything works just
> fine
> > > but I
> > > > > can not change the locale of default bundle on the fly.
> > > > >
> > > > > Doing this :
> > > > >
> > > > > <fmt:setLocale value="en_US" scope="session"/>
> > > > >
> > > > > does not help. Can anyone point me in the right direction ?
> > > > >
> > > > >
> > > > > Regards ,
> > > > > Dima Gutzeit.
> > > > > ---------------------------------
> > > > > MailVision LTD.
> > > > > R&D Team.
> > > > > Phone: 972-4-8500505 ext. 14
> > > > > Fax: 972 - 4 - 8508000
> > > > > http://www.mailvision.com
> > > >
> > > > -- 
> > > > Kris Schneider <ma...@dotech.com>
> > > > D.O.Tech       <http://www.dotech.com/>
> >
> > -- 
> > Kris Schneider <ma...@dotech.com>
> > D.O.Tech       <http://www.dotech.com/>

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: FMT question

Posted by Dima Gutzeit <di...@mailvision.net>.
Here is the summary of the behaviour on my side :

On the first page of the application everything works great. Problem starts
when I <c:redirect> to another JSP page in the application.

On this new page , the application totaly "forget" what locale has been set
nad takes the settings from web.xml

Both pages are in the same application , sharing the same session.

Anyone has ideas ?

----- Original Message ----- 
From: "Kris Schneider" <kr...@dotech.com>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Sent: Monday, January 26, 2004 7:16 PM
Subject: Re: FMT question


> It seems to work for me. Here's my setup:
>
> /WEB-INF/classes/Messages.properties (msg=root)
> /WEB-INF/classes/Messages_en_US.properties (msg=en_US)
> /WEB-INF/classes/Messages_fr.properties.properties (msg=fr)
>
> web.xml:
>
> <context-param>
>   <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
>   <param-value>Messages</param-value>
> </context-param>
>
> If my JSP just has this:
>
> msg: <fmt:message key="msg"/>
>
> It produces:
>
> msg: root
>
> If I change the JSP to:
>
> <fmt:setLocale value="fr" scope="session"/>
> msg: <fmt:message key="msg"/>
>
> It produces:
>
> msg: fr
>
> Quoting Dima Gutzeit <di...@mailvision.net>:
>
> > I have bundle_en_US as well as bundle_ru_RU. I can not "switch" the fmt
to
> > use another locale file during the runtime while changing it in web.xml
:
> >
> > <context-param>
> >                 <param-name>
> >                  javax.servlet.jsp.jstl.fmt.locale
> >                 </param-name>
> >                 <param-value>
> >                 en_US
> >         </param-value>
> >
> > and restarting the app works fine.
> >
> > ----- Original Message ----- 
> > From: "Kris Schneider" <kr...@dotech.com>
> > To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
> > Sent: Monday, January 26, 2004 6:27 PM
> > Subject: Re: FMT question
> >
> >
> > > What property files (resource bundles) are available in your app? Do
you
> > have
> > > either a bundle_en.properties or a bundle_en_US.properties file?
> > >
> > > Quoting Dima Gutzeit <di...@mailvision.net>:
> > >
> > > > Dear list members ,
> > > >
> > > > I am using to FMT taglibrary for localization of my webapp.
> > > > Whe defining the locale in the web.xml file everything works just
fine
> > but I
> > > > can not change the locale of default bundle on the fly.
> > > >
> > > > Doing this :
> > > >
> > > > <fmt:setLocale value="en_US" scope="session"/>
> > > >
> > > > does not help. Can anyone point me in the right direction ?
> > > >
> > > >
> > > > Regards ,
> > > > Dima Gutzeit.
> > > > ---------------------------------
> > > > MailVision LTD.
> > > > R&D Team.
> > > > Phone: 972-4-8500505 ext. 14
> > > > Fax: 972 - 4 - 8508000
> > > > http://www.mailvision.com
> > >
> > > -- 
> > > Kris Schneider <ma...@dotech.com>
> > > D.O.Tech       <http://www.dotech.com/>
>
> -- 
> Kris Schneider <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: FMT question

Posted by Kris Schneider <kr...@dotech.com>.
It seems to work for me. Here's my setup:

/WEB-INF/classes/Messages.properties (msg=root)
/WEB-INF/classes/Messages_en_US.properties (msg=en_US)
/WEB-INF/classes/Messages_fr.properties.properties (msg=fr)

web.xml:

<context-param>
  <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
  <param-value>Messages</param-value>
</context-param>

If my JSP just has this:

msg: <fmt:message key="msg"/>

It produces:

msg: root

If I change the JSP to:

<fmt:setLocale value="fr" scope="session"/>
msg: <fmt:message key="msg"/>

It produces:

msg: fr

Quoting Dima Gutzeit <di...@mailvision.net>:

> I have bundle_en_US as well as bundle_ru_RU. I can not "switch" the fmt to
> use another locale file during the runtime while changing it in web.xml  :
> 
> <context-param>
>                 <param-name>
>                  javax.servlet.jsp.jstl.fmt.locale
>                 </param-name>
>                 <param-value>
>                 en_US
>         </param-value>
> 
> and restarting the app works fine.
> 
> ----- Original Message ----- 
> From: "Kris Schneider" <kr...@dotech.com>
> To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
> Sent: Monday, January 26, 2004 6:27 PM
> Subject: Re: FMT question
> 
> 
> > What property files (resource bundles) are available in your app? Do you
> have
> > either a bundle_en.properties or a bundle_en_US.properties file?
> >
> > Quoting Dima Gutzeit <di...@mailvision.net>:
> >
> > > Dear list members ,
> > >
> > > I am using to FMT taglibrary for localization of my webapp.
> > > Whe defining the locale in the web.xml file everything works just fine
> but I
> > > can not change the locale of default bundle on the fly.
> > >
> > > Doing this :
> > >
> > > <fmt:setLocale value="en_US" scope="session"/>
> > >
> > > does not help. Can anyone point me in the right direction ?
> > >
> > >
> > > Regards ,
> > > Dima Gutzeit.
> > > ---------------------------------
> > > MailVision LTD.
> > > R&D Team.
> > > Phone: 972-4-8500505 ext. 14
> > > Fax: 972 - 4 - 8508000
> > > http://www.mailvision.com
> >
> > -- 
> > Kris Schneider <ma...@dotech.com>
> > D.O.Tech       <http://www.dotech.com/>

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: FMT question

Posted by Dima Gutzeit <di...@mailvision.net>.
I have bundle_en_US as well as bundle_ru_RU. I can not "switch" the fmt to
use another locale file during the runtime while changing it in web.xml  :

<context-param>
                <param-name>
                 javax.servlet.jsp.jstl.fmt.locale
                </param-name>
                <param-value>
                en_US
        </param-value>

and restarting the app works fine.

----- Original Message ----- 
From: "Kris Schneider" <kr...@dotech.com>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Sent: Monday, January 26, 2004 6:27 PM
Subject: Re: FMT question


> What property files (resource bundles) are available in your app? Do you
have
> either a bundle_en.properties or a bundle_en_US.properties file?
>
> Quoting Dima Gutzeit <di...@mailvision.net>:
>
> > Dear list members ,
> >
> > I am using to FMT taglibrary for localization of my webapp.
> > Whe defining the locale in the web.xml file everything works just fine
but I
> > can not change the locale of default bundle on the fly.
> >
> > Doing this :
> >
> > <fmt:setLocale value="en_US" scope="session"/>
> >
> > does not help. Can anyone point me in the right direction ?
> >
> >
> > Regards ,
> > Dima Gutzeit.
> > ---------------------------------
> > MailVision LTD.
> > R&D Team.
> > Phone: 972-4-8500505 ext. 14
> > Fax: 972 - 4 - 8508000
> > http://www.mailvision.com
>
> -- 
> Kris Schneider <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: FMT question

Posted by Kris Schneider <kr...@dotech.com>.
What property files (resource bundles) are available in your app? Do you have
either a bundle_en.properties or a bundle_en_US.properties file?

Quoting Dima Gutzeit <di...@mailvision.net>:

> Dear list members ,
> 
> I am using to FMT taglibrary for localization of my webapp.
> Whe defining the locale in the web.xml file everything works just fine but I
> can not change the locale of default bundle on the fly.
> 
> Doing this :
> 
> <fmt:setLocale value="en_US" scope="session"/>
> 
> does not help. Can anyone point me in the right direction ?
> 
> 
> Regards , 
> Dima Gutzeit.
> ---------------------------------
> MailVision LTD. 
> R&D Team. 
> Phone: 972-4-8500505 ext. 14 
> Fax: 972 - 4 - 8508000 
> http://www.mailvision.com 

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org