jsp中跳转的用法和区别
区别
- 首先我们要知道的是forward是转发,地址用的是原地址,但是内容变为设置转向地址的内容。
- redirect : re代表重新 direct代表定向、定位,所以redirect是重定向。作用是重新确定网址和页面内容,也就是说redirect才是我们常规意义里的跳转
用法
forward的用法
<jsp:forward page="customer_shop.jsp"></jsp:forward>
不包括在<%%>里,因为这属于前端语言
redirect的用法
<%
response.sendRedirect("customer_shop.jsp");
%>
必须包含在jsp里