I want to use charset="GB2312" in JSTL,and input information with GB2312 code 
in index.jsp page and then I post it  to show_parameters.jsp page,I find the 
charset is not show properly. It shows some '?'.
Why? My code is follows:

*********index.jsp**************
<html>
<head>
<title>Request Decoding by Hand</title>
 </head>
<body>
<%@ taglib uri='http://java.sun.com/jstl/fmt' prefix='fmt'%>
<%@ taglib uri='http://java.sun.com/jstl/core' prefix='c' %>
<%@ page contentType='text/html; charset=GB2312' %>
<fmt:setLocale value='zh'/>
<fmt:setBundle basename='app'/>
<fmt:message key='login.form.title'/><hr>
<form action='show_parameters.jsp'>
<table>
<tr>
<td><fmt:message key='login.textfield.name'/></td>
<td><input type='text' name='name' value='<fmt:message 
key="login.textfield.nameValue"/>'/> </td>
</tr></table> <br>
<input type='submit' value='<fmt:message key="login.button.submit"/>'/>
</form>
 <c:set var='requestCharset' value='GB2312' scope='session'/> Response Charset: 
<c:out value='${pageContext.response.characterEncoding}'/>
</body>
</html>

********show_parameters.jsp***********
<html>
 <head>
 <title>Request Decoding by Hand</title>
</head>
<body>
 <%@ taglib uri='http://java.sun.com/jstl/fmt' prefix='fmt'%>
 <%@ taglib uri='http://java.sun.com/jstl/core' prefix='c' %>
 <%@ page contentType='text/html; charset=GB2312' %>
 <% String charset = 
(String)pageContext.getAttribute("requestCharset",PageContext.SESSION_SCOPE); 
request.setCharacterEncoding(charset); %> Request Charset: <c:out 
value='${pageContext.request.characterEncoding}'/>
Name: <c:out value='${param.name}'/> Request Charset: <c:out 
value='${pageContext.request.characterEncoding}'/>
</body>
 </html>

********app_zh.properties***********
login.page.title=\u8bf7\u767b\u5f55
login.form.title=\u8bf7\u767b\u5f55
login.textfield.name=\u7528\u6237\u540d
login.textfield.nameValue=\u7528\u6237\u540d\u767b\u5f55
login.textfield.pwd=\u5bc6\u7801
login.button.submit=\u767b\u5f55

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to