“EL表达式”不起作用,${}原样输出


jsp页面忽视了el标签,要加入<%@ page isELIgnored="false" %>,这只是妥协方案

注:EL表达式不需要引入包,tomcat自带,与servlet的包有关

解决根本方法:

  1.如果JSP中无法自动提示EL表达式的解决方法,在maven的pom.xml中加入如下代码

 1 <dependency>
 2 
 3    <groupId>javax.servlet</groupId>
 4 
 5    <artifactId>jsp-api</artifactId>
 6 
 7    <version>2.0</version>
 8 
 9    <scope>provided</scope>
10 
11 </dependency>
pom.xml

  2.如果JSP中EL表达式不起作用,原样输出,可以更改web.xml的web-app标签中的命名空间来解决

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

      3.web.xml中配置

1 <jsp-config>     
2   <jsp-property-group>         
3     <url-pattern>/jsp/* </url-pattern>     
4     <el-ignored>true</el-ignored>        
5   </jsp-property-group>     
6 </jsp-config>
web.xml

 

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM