Quoting Harod Ruthgar <[EMAIL PROTECTED]>:

> Hello,
> 
> I have several questions regarding JSTL:
> 
> 1) When using fmt tag, how to use multiple bundles on
> the same page?
> 
> I tried:
> <fmt:setBundle basename="bundle1" var="myBundle1"/>
> <fmt:setBundle basename="bundle2" var="myBundle2"/>
> 
> <fmt:message key="text1" bundle="${myBundle1}"/>
> <fmt:message key="text2" bundle="${myBundle2}"/>
> 
> It gives the correct value of text2, and an error
> message for text1, i.e.
> ??text1??
> If I set bundle1 after bundle2, I got the correct
> value for text2, but not
> for text1.

What happens with:

<fmt:bundle basename="bundle1">
  <fmt:message key="text1"/>
</fmt:bundle>

<fmt:bundle basename="bundle2">
  <fmt:message key="text2"/>
</fmt:bundle>

> 2) When using c:forTokens, is there a way to find out
> that the current token
>    is the last token?

<c:forTokens items="..."
             delims="..."
             varStatus="status">
  <c:if test="${status.last}">
    ...
  </c:if>
</c:forEach>

> 3) Is it possible to get the current locale by using
> fmt tag?

Not that I'm aware of. I'm assuming this is for debugging, so you might try
something like:

<%@ page import="javax.servlet.jsp.jstl.core.*" %>
...
<%
LocalizationContext locCtx = Config.find(pageContext,
                                         Config.FMT_LOCALIZATION_CONTEXT);
pageContext.setAttribute("locCtxLocale", locCtx.getLocale());
%>
<c:out value="${locCtxLocale}"/>

> Thanks in advance.
> 
> Harod Ruthgar
> - when the horn doesn't work, watch out for the fingers

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

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

Reply via email to