0

I've got an existing Netbeans/Glassfish web application that was created automatically using one of the Netbeans wizards.

The project structure has

/src
    /conf
    /java/com/java source here
/web
    /WEB-INF
    /css
    /img
    etc

I'm not looking to i18n the project, replacing the hard coded strings with messages from a properties file.

The actual process of performing the translations and placing them into the JSP seems straightforwards enough - but what I don't understand is where I should place the properties file containing the translations.

The best place I can think of is inside /web/WEB-INF but I'm not sure that that is the right place and Google has failed me. Is WEB-INF the correct place for the translations files to go?

Tim B
  • 40,716
  • 16
  • 83
  • 128

1 Answers1

0

Thanks to the help in the comments.

I created messages.properties in the default package

I added

<bean id="messageSource"
        class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basename" value="messages" />
</bean>

to dispatcher-servlet.xml

I added

<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>

To the top of the jsp file and then.

    <title><spring:message code="login.title" /></title>

Correctly showed the page with the translated title.

Tim B
  • 40,716
  • 16
  • 83
  • 128