您的位置:首页 > Web前端 > JavaScript

<jsp:param>标签的使用

2017-09-25 21:14 429 查看
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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: