使用:
- 導(dǎo)入那兩個jar包 ->查找fmt.tld的uri -> 導(dǎo)入
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
2.登錄國際化
<body>
<fmt:setLocale value="zh_CN"/> <!--指定區(qū)域語言-->
<a href="${pageContext.request.contextPath}/international.jsp?lan=zh">中文</a>
<a href="${pageContext.request.contextPath}/international.jsp?lan=en">英文</a>
<c:if test="${param.lan=='en' }">
<fmt:setLocale value="en_US"/>
</c:if>
<fmt:bundle basename="globalMessages"> <!--指定使用basename為globalMessages的-->
<form action="${pageContext.request.contextPath}/in.jsp" method="post">
<fmt:message key="username"/>:<input type="text" name="username" value=""/><br/>
<fmt:message key="password"/>:<input type="password" name="password" value=""/><br/>
<button type="submit"><fmt:message key="submit"/></button>
</form>
</fmt:bundle>
</body>