JavaWeb相关记录

路径问题

在这里插入图片描述
网页路径:http://localhost:8080/school/admin/login.jsp
在这里插入图片描述
${pageContext.request.contextPath} 作用是取出部署的应用程序名
这里的结果为 /school
<% request.getContextPath(); %>也行
EL隐式对象没有request,但有pageContext可以获取jsp页面中其他8个隐式对象

同样一个页面,客户端跳转与服务器跳转的相对路径是不一样的。服务器的跳转(不包括重定向)都是相对于http://localhost:8080/项目名/,而客户端的跳转是相对于http://localhost:8080的。

浏览器中/admin/login最前面的/ 的作用是获取 http://localhost:8080
结果为http://localhost:8080/admin/login
而后台路径设置为:
在这里插入图片描述
urlPatterns = "/admin/login"的全路径是http://localhost:8080/school/admin/login
在这里插入图片描述
在这里插入图片描述

  • 请求跳转
    /admin/login.jsp后台路径都是http://localhost:8080/school/admin/login.jsp
    在这里插入图片描述admin/login.jsp后台路径都是http://localhost:8080/school/admin/admin/login.jsp
    说明这里是相对request URL的路径

  • 重定向
    路径相对于http://localhost:8080 所以要加上request.getContextPath()

JavaWeb乱码问题及统一全站编码(通过Filter实现)

1.教材学习笔记
https://blog.csdn.net/qq_40788630/article/details/84677882
2.传智书城之增强过滤器
https://blog.csdn.net/qq_40788630/article/details/84677882
3.过滤器解释
https://blog.csdn.net/weixin_44718300/article/details/88368145

拦截与servlet登录session的使用

https://blog.csdn.net/weixin_44594257/article/details/89606010

el表达式获取不到值报错

在这里插入图片描述
来源 https://blog.csdn.net/qq_43371556/article/details/90209428

猜你喜欢

转载自blog.csdn.net/Jruo911/article/details/106209315