Hi,
I am adding localisation to an old jsp application. My intention was to use jstl to handle the application side localisation. I added:
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>i18n.messages</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name>
<param-value>en</param-value>
</context-param>
and made an include in one jsp:
<jsp:root version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:fmt="http://java.sun.com/jstl/fmt">
and tried to use a messages bundle:
<fmt:message key="welcome" />
Unfortunatelly the result is not what I would like to see. From the two messages files I defined: messages_en and messages_de, only one is read. So the message is shown in german for example, but after changing the locale to english it stays in german. Furthermore this test shows two times the same message - the german version for example.
<fmt:setLocale
value="de_DE" scope="session" />
<fmt:setBundle basename="i18n.messages"
scope="session" /> DE: <fmt:message key="welcome" />
<fmt:setLocale
value="en_GB" scope="session" />
<fmt:setBundle basename="i18n.messages"
scope="session" /> EN: <fmt:message key="welcome" />
I would appreciate any help as I lack experience in jsp.
Regards