Hi Christian,
On 10/20/2003 12:53 PM Christian Martin wrote:
my questions for now:
1) in which scope does <message-resource ... /> store the message resource?
in application scope I think.
2) is it possible to access this message resource due EL and how?
Try applicationScope["tst"]
3) does <fmt:message bundle="${scope.ctx}" /> need a LocalizationContext or does it also work with a message resource
i am climbing the learning curve. *lol*
Well on this question, so am I! My best guess is yes, it does. However I haven't done this yet. I'm sure you can reference the bundles you create with the code shown below. Have you read the i18n chapter of the JSTL 1.0 spec from Sun? It is quite informative on this issue.
Adam
-------------------------------------------------------------------------- sorry i can't stop asking questions. something forces me to keep on asking
Adam Hardy wrote:
On 10/17/2003 02:17 PM Kris Schneider wrote:
One approach you could take would be to create your set of alternate LocalizationContext instances at application startup and store them in application scope:
ResourceBundle countriesBundle = ResourceBundle.getBundle("countries", locale);
LocalizationContext countriesCtx = new LocalizationContext(countriesBundle, locale);
servletCtx.setAttribute("countriesCtx", countriesCtx);
ResourceBundle statesBundle = ResourceBundle.getBundle("states", locale);
LocalizationContext statesCtx = new LocalizationContext(statesBundle, locale);
servletCtx.setAttribute("statesCtx", statesCtx);
Then, in your JSP:
<fmt:message bundle="${applicationScope.countriesCtx}" key="message.test">
<fmt:message bundle="${applicationScope.statesCtx}" key="message.test">
in web.xml this will set up one as the default so you only need to programmatically set up the others, so at least for the most-used bundle you won't have to specify the 'bundle' attribute:
<context-param> <param-name> javax.servlet.jsp.jstl.fmt.localizationContext </param-name> <param-value>ApplicationResources</param-value> </context-param>
-- -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

