< jsp:forward page=” 要跳转的页面”>
< jsp:param value=”” name=””>
< / jsp:forward >
服务器内部跳转,可带参数!
代码:
forward.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>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>2</title>
</head>
<body>
<jsp:forward page="target.jsp">
<jsp:param value="world" name="Str" />
</jsp:forward>
</body>
</html>
target.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>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>2</title>
</head>
<body>
服务器内部 跳转后的页面<br>
hello:<%=request.getParameter("Str") %>
</body>
</html>
运行结果:
结论:
1.服务器内部跳转不会在地址栏显示跳转过程
2.服务器跳转可以带参跳转