Java Reference
In-Depth Information
a prefix. Let's say that we still want to prefix the keys with the action
bean class name. Adding ${actionBean.class.name} in front of the key will
do it: 3
Download email_20/web/WEB-INF/jsp/common/taglibs.jsp
<c:set var="contextPath" value="${pageContext.request.contextPath}"/>
<c:set var="prefix" value="${actionBean.class.name}"/>
Download email_20/web/WEB-INF/jsp/login.jsp
<fmt:message var="title" key="${prefix}.title"/>
<s:layout-render name="/WEB-INF/jsp/common/layout_main.jsp"
title="${title}">
<s:layout-component name="body">
<p><fmt:message key="${prefix}.pleaseLogin"/> : </p>
<s:form beanclass="stripesbook.action.LoginActionBean">
<!-- same as before... -->
</s:form>
<s:link beanclass="stripesbook.action.RegisterActionBean">
<fmt:message key="${prefix}.register"/>
</s:link>
<fmt:message key="${prefix}.toCreateAnAccount"/> .
</s:layout-component>
</s:layout-render>
The translated text is in the resource bundles:
Download email_20/res/StripesResources.properties
stripesbook.action.LoginActionBean.title=Login
stripesbook.action.LoginActionBean.pleaseLogin=Please login
stripesbook.action.LoginActionBean.toCreateAnAccount=\
to create an account
stripesbook.action.LoginActionBean.register=Register
Download email_20/res/StripesResources_fr.properties
stripesbook.action.LoginActionBean.title=Identification
stripesbook.action.LoginActionBean.pleaseLogin=Veuillez vous identifier
stripesbook.action.LoginActionBean.toCreateAnAccount=\
pour cr\u00e9er un compte
stripesbook.action.LoginActionBean.register=Enregistrez-vous
All the text for the Login page is now translated in StripesResources_fr.
properties , and the page is available in French, as shown in Figure 11.3 ,
on the following page.
3. Using the action bean prefix is, of course, totally optional. You can also use plain
keys.
 
 
Search WWH ::




Custom Search