“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