<jsp:param>标签的使用
1:main.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<% request.setCharacterEncoding("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>主页面</title>
</head>
<body>
<div align="center">
<table>
<tr>
<th>主页面</th>
</tr>
</table>
</div>
<jsp:include page="subPage.jsp">
<jsp:param value="John" name="userName"/>
<jsp:param value="10086" name="passwd"/>
<jsp:param value="陕西西安" name="address"/>
</jsp:include>
</body>
</html>
2:subPage
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<% request.setCharacterEncoding("UTF-8"); //设置页面传递参数的编码格式 %>
<%
String userName=request.getParameter("userName");
String passwd=request.getParameter("passwd");
String address=request.getParameter("address");
%>
<!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>子页面</title>
</head>
<body>
<div align="center">
<table>
<tr>
<th>子页面:人员信息</th>
</tr>
</table>
</div>
<div align="center">
<table>
<tr>
<td>用户名:<%=userName%></td>
</tr>
<tr>
<td>密 码:<%=passwd%></td>
</tr>
<tr>
<td>用户地址:<%=address%></td>
</tr>
</table>
</div>
</body>
</html>
- 上一篇: El调用javaBean(VO类+jsp)
- 下一篇: C语言 将一个字符串转化为整数