${pageContext.request.contextPath}无法解析乱码使用不了

简介: ${pageContext.request.contextPath}无法解析乱码使用不了

在jsp中

${pageContext.request.contextPath}解析乱码


${pageContext.request.contextPath}解析乱码或使用不了

image.png

解决方案:


web.xml 2.3版本不支持el表达式子 只要把版本换成2.3以上就可以 还有${pageContext}没有提示 没有导入jsp坐标 导入坐标就可以解决

web.xml

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
         http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

jsp坐标

    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.1</version>
    </dependency>


相关文章
|
4月前
|
JSON 缓存 Java
修改Request与Response中的内容
修改Request与Response中的内容
46 0
|
5月前
request.getParameter、request.getParameterValues、request.getParameterMap用法
request.getParameter、request.getParameterValues、request.getParameterMap用法
|
10月前
|
Java
PageContext request session application区别以及EL表达式
PageContext request session application区别以及EL表达式
68 0
|
Java Maven
JSP 使用 ${pageContext.request.contextPath} 无效
通过 ${pageContext.request.contextPath}可在JSP 中取得当前的项目绝对路径,比如当前项目是 http://localhost:8080/demo, 则 ${pageContext.request.contextPath} 代表的就是 /demo,其中 / 代表 http://localhost:8080,所以一般使用${pageContext.request.contextPath} 定位资源。
request.setAttribute的用法
request.setAttribute的用法
611 0
|
应用服务中间件 容器 数据安全/隐私保护
Servlet中request请求Get和Post方法以及乱码解决
前言: 传递的请求参数如何获取 GET方式: 参数放在URI后面 POST方式: 参数放在实体内容中 后台获取前台数据方法: 核心的API: request.getParameter("参数名"); 根据参数名获取参数值(注意,只能获取一个值的参数) request.
3032 0
|
应用服务中间件 API 开发者
Servlet中response、request乱码问题解决
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34173549/article/details/80097763 一、r...
1173 0