therollinone
05-08-2008, 01:30 PM
Hi there, I'm trying to add Internationalization feature to my website but it seems I just can't reach the "messages.properties" file. All I get in my jsp page is ???heading??? or such. I'll try to give you an overview of my website structure and files see if you can find what I'm doing wrong ...
Btw, Im using Apache Tomcat 5.5 (if it has any impact, I doubt so ...) and I'm implementing the site using Spring model.
Website structure : (found in the webapps folder of Tomcat)
<PROJECT>
....index.jsp
....<WEB-INF>
........project-servlet.xml
........web.xml
........<CLASSES>
............messages.properties
............<BUS>
................project java classes (business logic)
............<WEB>
................project java classes (web logic)
........<JSP>
................hello.jsp (file from wich I can't access messages.properties)
........<LIB>
................all ext. libraries (.jar)
Files content : (only parts I think have an impact, hopefully I didn't forget any :confused: )
hello.jsp
<%@ include file="/WEB-INF/jsp/include.jsp" %>
<html>
<head><title><fmt:message key="title"/></title></head>
<body>
<h1><fmt:message key="heading"/></h1>
... ... ...
</body>
</html>
project-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
... ... ...
<beans>
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename"><value>messages</value></property>
</bean>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/hello.htm">springappController</prop>
</props>
</property>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>
<property name="prefix"><value>/WEB-INF/jsp/</value></property>
<property name="suffix"><value>.jsp</value></property>
</bean>
</beans>
messages.properties
title=SpringApp
heading=Hello :: SpringApp
That's about it, hope I didn't forget any files content, anyway if i did just tell me and I'll post them.
Hope you guys can find what's wrong or what I'm missing cause I've been trying to get that right for 3 days now. Moving files around, modyfing code here and there but nothing gave me any satisfying results ... :(
Thanks a lot
Btw, Im using Apache Tomcat 5.5 (if it has any impact, I doubt so ...) and I'm implementing the site using Spring model.
Website structure : (found in the webapps folder of Tomcat)
<PROJECT>
....index.jsp
....<WEB-INF>
........project-servlet.xml
........web.xml
........<CLASSES>
............messages.properties
............<BUS>
................project java classes (business logic)
............<WEB>
................project java classes (web logic)
........<JSP>
................hello.jsp (file from wich I can't access messages.properties)
........<LIB>
................all ext. libraries (.jar)
Files content : (only parts I think have an impact, hopefully I didn't forget any :confused: )
hello.jsp
<%@ include file="/WEB-INF/jsp/include.jsp" %>
<html>
<head><title><fmt:message key="title"/></title></head>
<body>
<h1><fmt:message key="heading"/></h1>
... ... ...
</body>
</html>
project-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
... ... ...
<beans>
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename"><value>messages</value></property>
</bean>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/hello.htm">springappController</prop>
</props>
</property>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>
<property name="prefix"><value>/WEB-INF/jsp/</value></property>
<property name="suffix"><value>.jsp</value></property>
</bean>
</beans>
messages.properties
title=SpringApp
heading=Hello :: SpringApp
That's about it, hope I didn't forget any files content, anyway if i did just tell me and I'll post them.
Hope you guys can find what's wrong or what I'm missing cause I've been trying to get that right for 3 days now. Moving files around, modyfing code here and there but nothing gave me any satisfying results ... :(
Thanks a lot