Resolve the issue of EL not being supported in jsp development

  • 2020-05-12 03:01:44
  • OfStack

The problem was in the web.xml statement at the time of Web Project.
web.xml declaration part 1 is divided into the following versions of xsd,
web-app_2_2.dtd
web-app_2_3.dtd
web-app_2_4.xsd
web-app_2_5.xsd

A more detailed list of the versions of web.xml declaration section is as follows:
web-app_2_2.dtd

< ?xml version="1.0" encoding="UTF-8"? >
< !DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/dtd/web-app_2_2.dtd" >

web-app_2_3.xsd

< ?xml version="1.0" encoding="UTF-8"? >
< !DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >

web-app_2_4.xsd

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

web-app_2_5.xsd

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

Attention!!!!! servlets 2.4(the first version after JSP 2.0, if I remember correctly), this version of isELIgnored is set to false by default. So when you use web.xml and you use web-app_2_4.xsd you don't have to declare it on the JSP page. servlets 2.4EL can be used directly.

Others must be declared manually.
Make sure that xsd version in web.xml (if not servlets 2.4) 1 must be declared in JSP ( < %@page % > ), as follows:
< %@ page isELIgnored="false" % >
or
To set the entire project to use the el expression, add (control 1 item) to web.xml
< jsp-config >
< jsp-property-group >
< el-ignored > false < /el-ignored >
< /jsp-property-group >
< /jsp-config >

To parse the EL expression, set it to false.

Also, the easiest solution is to replace your current reference to servlets 2.4xsd directly in web.xml. Replace with the following reference.
< web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >

Related articles: