Solve the problem that El is not supported in JSP development

Time:2021-7-24

The problem lies in the web.xml declaration when building a web project.
The web.xml declaration part is generally 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

List the web.xml declaration of each version in more detail, 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”>

be careful!! Among them, servlets 2.4 (the first version after JSP 2.0 comes out if I remember correctly), and iselignored of this version is set to false by default. So use web app in web.xml_ 2_ 4. When XSD is declared, there is no need to declare it on the JSP page. Servlets 2.4el can be used directly.

Others cannot, and must be stated manually
After determining the XSD version in web.xml (if not servlets 2.4), be sure to add a line in the declaration (<% @ page% >) part of JSP, as follows:
<%@ page isELIgnored=”false” %>
perhaps
To set the El expression for the whole project, you need to add (control a project) in web.xml
<jsp-config>
<jsp-property-group>
<el-ignored>false</el-ignored>
</jsp-property-group>
</jsp-config>

Set to false to resolve the El expression.

The simplest solution is to replace the reference of servlets 2.4xsd in web.xml directly. 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”>

Recommended Today

Implementation example of go operation etcd

etcdIt is an open-source, distributed key value pair data storage system, which provides shared configuration, service registration and discovery. This paper mainly introduces the installation and use of etcd. Etcdetcd introduction etcdIt is an open source and highly available distributed key value storage system developed with go language, which can be used to configure sharing […]