发送参数:
<a href="deal.jsp?id=1&user=用户&pwd=">处理页</a>
接收参数:
<%
String id = request.getParameter("id");
String user = request.getParameter("user");
String pwd = request.getParameter("pwd");
String notExist = request.getParameter("notExist");
%>
结果:
id参数为:1
user参数为:用户
pwd参数为:
notExist参数为:null
getAttribute.jsp
<%@ 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>
<%
String result = request.getAttribute("result").toString();
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>getAttribute</title>
</head>
<body>
单价为: <%=result %>
</body>
</html>
<a href="getAttribute.jsp">getAttribute</a>:报错
<jsp:forward page="getAttribute.jsp"></jsp:forward>:成功