caiyao

1. sendRedirect 后面要加上return。
2. sendRedirect 执行过程是先转向还是先执行后续代码再转向?
答: 先执行代码再转向,在一个sendRedirect后面不能再有其他向页面中写入的操作。

3. 关于在redirect中相对地址的写法:

在servlet中配置的Servlet请求URL为:
/test/servlet/TestRediect
请求URL
test/servlet/TestRediect
转向URL
/rediectPage.jsp : http://localhost:8080/rediectPage.jsp
./rediectPage.jsp : http://localhost:8080/webtest2/test/servlet/rediectPage.jsp
../rediectPage.jsp : http://localhost:8080/webtest2/test/rediectPage.jsp
.../rediectPage.jsp : http://localhost:8080/webtest2/test/servlet/.../rediectPage.jsp
使用点转向页面注意:
一个点相当于请求URL中去掉最底一层的URL/
两个点相当于请求URL中去掉最底两层的url/

最好使用:
/webtest2/rediectPage.jsp : http://localhost:8080/webtest2/rediectPage.jsp

分类:

技术点:

相关文章:

  • 2021-12-14
  • 2022-12-23
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2018-09-15
  • 2018-11-10
猜你喜欢
  • 2022-01-21
  • 2021-11-24
  • 2022-12-23
  • 2022-03-09
  • 2021-07-25
相关资源
相似解决方案