[EMAIL PROTECTED] wrote:
Well, if I take a look at jstl.jar, it shows in
javax.servlet.jsp.jstl.core.Config the following:

final public static java.lang.String FMT_LOCALIZATIONCONTEXT =
"javax.servlet.jsp.jstl.fmt.localizationContext";

(viewed with Eclipse).

If so you're using a pre-release version of the Standard library. The constant names where changed before FJSTL 1.0 CS and the Config implementation in the Standard library implementation was updated April 29, 2002. I suggest you upgrade to Standard 1.0.3.

Hans

-----Original Message-----
From: Martin van Dijken [mailto:[EMAIL PROTECTED]
Sent: Mittwoch, 9. Juli 2003 17:53
To: Tag Libraries Users List
Subject: RE: How to create a general resource bundle for JSTL?


Now you're confusing me;)


The spec clearly states that the Config class has a:

public static final String FMT_LOCALIZATION_CONTEXT;

Therefore this IS the correct spelling...

Martin


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: woensdag 9 juli 2003 17:53
To: [EMAIL PROTECTED]
Subject: RE: How to create a general resource bundle for JSTL?


Hi Martin


Yup, I noticed it and told Shawn Bayern, because in JSTL in Action it's
written as FMT_LOCALIZATION_CONTEXT (which would be the right way to spell
it IMHO).


Best regards,
Eric

P.S. Good luck with the path!

-----Original Message-----
From: Martin van Dijken [mailto:[EMAIL PROTECTED]
Sent: Mittwoch, 9. Juli 2003 17:33
To: Tag Libraries Users List
Subject: RE: How to create a general resource bundle for JSTL?


Hey Eric,


I've got to start working heavily with I18N currently and am investigating
some of the same paths you go along. You did notice that the
FMT_LOCALIZATIONCONTEXT is not the correct naming, but that
FMT_LOCALIZATION_CONTEXT is? I guess you must have because stuff probably
doesn't compile otherwise, but I thought I should point it out.


Martin


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: dinsdag 8 juli 2003 16:29
To: [EMAIL PROTECTED]
Subject: RE: How to create a general resource bundle for JSTL?


Hi Martin


Thanks for the answer. However, your solution relies on JSTL alone, and this
works for me without any problems (see my code).
What doesn't work is setting a resource bundle with my Java class, without
having to set the bundle in the JSP.


Best regards,
Eric

-----Original Message-----
From: Martin van Dijken [mailto:[EMAIL PROTECTED]
Sent: Montag, 7. Juli 2003 15:58
To: Tag Libraries Users List
Subject: RE: How to create a general resource bundle for JSTL?


Hey Eric,


Let me give you an educated yet untested guess. I'm not very experienced
with JSTL, but noticed you weren't getting any response so let me try.


Have you tried setting the Locale of the ServletResponse object? I'm not
100% certain, but it seems to me JSTL *SHOULD* check this when using their
I18N tags. Furthermore if you want to use a resource bundle for a bunch of
tags it might do you some good to put the other I18N tags below them as
nested tags:


<fmt:setBundle basename="vulgarInsults"/>

<!-- Notice how the bundle tag surrounds the others... -->
<fmt:bundle basename="org.apache.bookies">
 <fmt:message key="threat" >
   <fmt:param value="${address}"/>
   <fmt:param value="${numberOfChildren}"/>
   <fmt:param value="${nameOfSpouse}"/>
 </fmt:message>
</fmt:bundle>

Greetings,

Martin van Dijken
Madocke Interactive Media



Hi all

Till now, all JSP pages in our application had to have the following header
for internationalization:
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"; %>
<fmt:setLocale value="${currentLocale}"/>
<fmt:setBundle basename="ch.xobix.i18n.translations.X2Resources"
var="bundle" scope="page"/>


Then a message would be output like this:
<fmt:message key="longWeekday_0" bundle="${bundle}"/>

Note that "currentLocale" is set by the controller, and
ch.xobix...X2Resources is a class that loads the messages from a database
table.
This works well, however I think it's tedious for the web designer to do
this manually all the time.


My goal is to have the following:
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"; %>

And the message output like this:
<fmt:message key="longWeekday_0"/>

So I tried to set it in the controller, as described in "JSTL in Action". I
managed to set the Locale right, but I don't know how to do the same with
the resources. First I tried according to the book to create a
ResourceBundle and a Locale and set JSTL's FMT_LOCALIZATIONCONTEXT (does
anyone know why this is written like this?). Didn't work...


Now I've seen that I can change the web.xml to read
<web-app>
  ...
  <context-param>

<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</pa
ram-name>
<param-value>ch.xobix.i18n.translations.X2Resources</param-value>
</context-param>
...
</web-app>


Now, in the controller, I set the Locale with
Config.set(this.getRequest(), Config.FMT_LOCALE, <the language code> );


and I see it in Tomcat's output:
DEBUG - Request: javax.servlet.jsp.jstl.fmt.locale = it (when changing to
Italian)


BUT the message itself doesn't change!

What am I doing wrong? Or how should I do it right?

Also, has anyone of you succeeded in dynamically changing resources? Right
now, when someone enters a new key in the database, we have

to restart


Tomcat.


Thanks for any help! Eric




---------------------------------------------------------------------

To unsubscribe, e-mail:

[EMAIL PROTECTED]


For additional commands, e-mail:

[EMAIL PROTECTED]




---------------------------------------------------------------------

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

[EMAIL PROTECTED]




---------------------------------------------------------------------

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

[EMAIL PROTECTED]



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


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




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


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


-- Hans Bergsten <[EMAIL PROTECTED]> Gefion Software <http://www.gefionsoftware.com/> Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0 Details at <http://TheJSPBook.com/>


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



Reply via email to