JSTL对国际化的支持

login.jsp
<%@ page language="java" contentType="text/html; charset=GB18030"
    pageEncoding="GB18030"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<fmt:setLocale value="${header['accept-language']}" />
<fmt:setBundle basename="resources.MessageResources"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title>
</head>
<body>
<form action="login.do" method="post">
	<fmt:message key="login.form.field.username"/>:<input type="text" name="username"><br>
	<fmt:message key="login.form.field.Password"/>:<input type="password" name="password" ><br>
	<input type="submit" value="<fmt:message key="login.form.button.login"/>">
</form>

</body>
</html>


MessageResources_en_US.properties
login.form.field.username=User Name
login.form.field.Password=Password
login.form.button.login=login

你可能感兴趣的:(java,html,jsp,sun)