${pathContext.request.contextPath}绝对路径错误解决方法
${pathConetxt.request.contextPath}是获取绝对路径的方法,但是使用使用发现路径错误,如下图:
这是因为我们用IDEA开发java web时会有一个jsp的EL表达式不起作用的问题,只需要在jsp页面设置其是否忽略EL表达式即可。
具体操作为:在<%@ page contentType=“text/html;charset=UTF-8” language=“java”%>标签内加上isElIgnored=“false”(false是支持el表达式,true是不支持),代码如下:
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
<title>index</title>
</head>
<body>
<a href="${pageContext.request.contextPath}/account/getsuccess">测试</a>
</body>
</html>