首页 > 其他 > 详细

forward转发指令的使用

时间:2014-09-01 00:33:12      阅读:309      评论:0      收藏:0      [点我收藏+]

forward转发指令是当页面使用了转发指令那么用户在浏览此页面的时候地址栏地址不发生变化就能跳转到另外一个页面。

index.jsp

<%@ page contentType="text/html;charset=GBK" language="java" errorPage="" %>
<html>
<head>
	<title>forward指令的使用---原始页面</title>
</head>
<body>
	<jsp:forward page="forward-result.jsp">
		<jsp:param name="age" value="29"/>
		<jsp:param name="name" value="zhangsan"/>
	</jsp:forward>
</body>
</html>
<%@ page contentType="text/html;charset=GBK"%>
<html>
<head>
	<title>转发结果页面</title>
</head>
<body>
	<%=request.getParameter("name")%><br/>
	<%=request.getParameter("age")%>
</body>
</html>

表面上看起来像是重新向新页面发送请求,实际上是它是完全采用了新页面来面对用户的请求而已。

forward转发指令的使用

原文:http://my.oschina.net/Sadhu/blog/308555

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!