If I understand your question correctly, you want to determinate which locale will be
used based on the accept-language list. The question comes down to how you wish your
application to behave in the regard. I know the answer for the "designed behavior".
(An article on this subject was published on the java.sun site some months ago.) When
a locale can't be related with the user identity, the first application supported
locale in the accept-language list is used. You shall have this application behavior
easily with the message tag alone. You don't need to use the setLocale tag at all. I
don't know anything else if you want your application behave in anothe fashion.
--
--------- Original Message ---------
DATE:
From: <[EMAIL PROTECTED]>
To: Tag Libraries Users List <[EMAIL PROTECTED]>
Cc:
>Right, you can set the FMT_LOCALE attribute and JSTL will use it. My problem is
>determining what Locale JSTL decided to use after parsing the Accept-Language header.
>I may have to do it in the JSP after the first call to fmt:message, and check the
>Locale that was set on the response:
>
><fmt:message key="welcome"/>
><fmt:setLocale value="${pageContext.response.locale}"/>
>
>Rick DeBay
>
>On Fri, 20 Feb 2004 20:05 , Vernon Wu <[EMAIL PROTECTED]> sent:
>
>>This shall help you out.
>>
>>javax.servlet.jsp.jstl.core.Config
>>
>>The following two methods:
>>
>>set(session, Config.FMT_LOCALE, ...);
>>get(session, Config.FMT_LOCALE)
>>--
>>
>>--------- Original Message ---------
>>
>>DATE:
>>From: [EMAIL PROTECTED]>
>>To: Tag Libraries Users List [EMAIL PROTECTED]>
>>Cc:
>>
>>>I agree about the plausability, but JSTL does freeze the charset (which is a
>>>little less likely to change). JSTL could also save the Accept-Language header
>>>that it used to come up with the browser locale, and if it changes reset the
>>>locale stored in the session.
>>>I imagine recalculating the appropriate locale every time isn't optimal.
>>>I'm using Java Web Services Developer Pack 1.3, so I think it's a beta version of
>>>JSTL 1.1 (does anyone know how to find out?). Can someone check if JSTL 1.1 GA
>>>stores anything for locale in the session?
>>>
>>>Thanks, Rick DeBay
>>>
>>>On Fri, 20 Feb 2004 12:13 , Kris Schneider [EMAIL PROTECTED]> sent:
>>>
>>>>It's plausible that a client may want to change their locale between requests,
>>>>so it wouldn't make much sense for JSTL to "freeze" it. Are you asking how to
>>>>find out which locale JSTL actually chooses for browser-based locale setting? I
>>>>don't think there's a convenient way to do that, but you can use the methods in
>>>>javax.servlet.jsp.jstl.fmt.LocaleSupport to leverage JSTL's locale-determination
>>>>logic for message lookups. Hm, the only gotcha is that it looks like you need a
>>>>handle to a PageContext instance. Not much good unless you're writing tag
>>>>handlers I guess...
>>>>
>>>>Quoting [EMAIL PROTECTED]:
>>>>
>>>>> To process a fmt:message tag, JSTL needs to determine the appropriate locale.
>>>>>
>>>>> I'm not explicitly setting a locale so that it'll use the browser-based
>>>>> approach.
>>>>> Once JSTL determines a locale using this method, I was under the impression
>>>>> that
>>>>> it's supposed to store this in session scope, but I'm only finding a
>>>>> request.charset in session scope.
>>>>> The spec isn't clear on this, does anyone know how I should get this
>>>>> information
>>>>> (I need it in an Action class).
>>>>>
>>>>> Rick DeBay
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
____________________________________________________________
Find what you are looking for with the Lycos Yellow Pages
http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]