传入参数
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>通过POST方法传递参数</title>
</head>
<body>
<form action="postMain.jsp" method="POST">
站点名:<input type="text" name="name">
<br/>
网 址:<input type="text" name="url"><br />
<input type="submit" name="submit" value="提交">
</form>
</body>
</html>
接收参数
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.io.*,java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Post方法跳转的页面</title>
</head>
<body>
<%
// 解决中文乱码的问题
String name = new String((request.getParameter("name")).getBytes("ISO-8859-1"),"UTF-8");
%>
<%String url = new String((request.getParameter("url")).getBytes("ISO-8859-1"),"UTF-8");
%>
输入的内容是: <%=name%> <br/><%=name%>
</body>
</html>