Solve the problem that EL is not supported in jsp development.

Source: Internet
Author: User

The problem lies in the Web. xml declaration when a web Project is created.
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

For more details, see the web. xml declaration section of each version, as shown below:
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">

Note !! Among them, servlets 2.4 (the first version after JSP 2.0 came out, if I remember correctly), isELIgnored of this version is set to false by default. So the use of web. xml with web-app_2_4.xsd declaration in the JSP page does not need to specifically declare. Servlets 2.4EL can be used directly.

Other statements cannot be manually stated.
After determining the xsd version in web. xml (if it is not servlets 2.4), add a line in the <% @ page %> part of the JSP declaration, as shown below:
<% @ Page isELIgnored = "false" %>
Or
To set the el expression for the entire project, add the el expression to the web. xml file (control a project)
<Jsp-config>
<Jsp-property-group>
<El-ignored> false </el-ignored>
</Jsp-property-group>
</Jsp-config>

If this parameter is set to false, the EL expression can be parsed.

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.