May 2015
Intermediate to advanced
234 pages
4h 18m
English
Next we will learn how to create a multilingual page (in English and French) using only one JSP, and display it in English by default, with a link to switch to French. We will then store the text outside the JSP, in both languages, in separate .properties files.
Here are the steps to build a bilingual JSP view:
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<html>
<body>
<h1><spring:message code="home.title" /></h1>
<p><spring:message code="home.intro" /></p>
<p>
<a href="?lang=en">English</a> |
<a href="?lang=fr">French</a>
</p>
</body>
</html>.properties file src/main/resources/messages.properties:home.title=Home home.intro=This is a magnificent ...
Read now
Unlock full access