<%@ page contentType="text/html; charset=gb2312" 
language="java" import="java.sql.*,javax.servlet.*,javax.servlet.http.*" errorPage="" %>
<%
request.setCharacterEncoding("gb2312");
%><html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
一个简单的聊天室
<br><hr><font color=red>
<% 
String content=(String)getServletContext().getAttribute(new String("chatTopic_1"));
out.println(content);
getServletContext().setAttribute("chatTopic_1",content+(String)request.getParameter("content")+"<br>");%>
</font>
<hr>
<form action="servletContext_chat.jsp">
<input type=text name=content>
<input type=submit value="说话呀">
</form>
</body>
</html>这样才可以将上面的程序输出来时,是中文,而不是什么???呢?