<%
request.setAttribute("date", new Date());
request.setAttribute("salary", 2300);
String code = request.getParameter("code");
if (code != null && "en".equals(code)) {
session.setAttribute("locale", Locale.US);
} else {
session.setAttribute("locale", Locale.CHINA);
}
%>
<c:if test="${sessionScope.locale !=null}">
<fmt:setLocale value="${sessionScope.locale}"/>
</c:if>
<fmt:setBundle basename="i18n"/>
<fmt:message key="date"></fmt:message>
<fmt:formatDate value="${date}" dateStyle="Long"/>
<fmt:message key="salary"></fmt:message>
<fmt:formatNumber value="${salary}" type="currency"></fmt:formatNumber>
<a href="index.jsp?code=en">英文</a>
<a href="index.jsp?code=cn">中文</a>