<html>
<!--http://localhost:8080/test_jsp/input.html -->
<head>
<meta http-equiv="Content-Type" content="text/HTML; charset=utf-8">
<title>input页面</title>
</head>
<body>
<form action="input.jsp" method="post">
姓名:<input type="text" name="info"> <input type="submit"
value="提交">
</form>
</body>
</html>
input.html
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/HTML; charset=gbk">
<title>测试input</title>
</head>
<body>
<%
// 设置字符串编码,解决乱码问题
request.setCharacterEncoding("utf-8");
String str = request.getParameter("info");
out.println("<h1>" + str + "</h1>");
%>
<%=str%>
<%="你好"%>
</body>
</html>
input.jsp