Invalid EL expression (web created by Maven skeleton)

Invalidation of EL expression

Find out by consulting data

Servlet 2.3 / JSP 1.2 does not support EL expressions by default, while Servlet 2.4 / JSP 2.0 or higher supports

The web.xml header in the web project created by the webapp skeleton is as follows

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

This is obviously the version of Sevlet2.3/JSP1.2, the default is not to open the EL expression

So there are two solutions

method one

Open EL expression for each jsp page

Add the following code to the head

<%@ page isELIgnored="false" %> 

Method two (recommended)

Modify the header information of web.xml, use Servlet 2.4 / JSP 2.0 or higher

Version 2.4

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 
xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

Version 2.5

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5">

Guess you like

Origin blog.csdn.net/ren9436/article/details/108434436
Recommended