Recently, I received the source code of a project. After the deployment, I opened the page and found that the El expressions on the JSP page were not parsed and displayed as they are.
I searched the internet for the reason. It turned out to be a problem with the servlet version. In the original servlet, you can set whether to parse the El expression. Only the servlet of version 2.4 parses the El expression by default, while other versions do not parse the El expression by default. Check the program, it does not actually use version 2.4. Therefore, the servlet of Version 2.5 used in Web. XML is changed to version 2.4.
<Web-app version = "2.5" xmlns = "http://java.sun.com/xml/ns/javaee"
Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
Xsi: schemalocation = "http://java.sun.com/xml/ns/javaee
Http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd>
Replace
<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>
After the redeployment is started, you can parse the El expression.
Of course, Servlet of other versions only does not parse El expressions by default, but on the JSP page to be parsed
You can add
<% @ Page elignored = "false" %>
To explicitly parse the El expression in the JSP page