When I was practicing, I encountered an El expression that was treated as a string and did not parse correctly. The Javaee5 used in the project,
Xml
<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 ">
El expression is not resolved, is treated as a string.
Then I changed the Web.xml into
<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 ">
Redeploy, start Tomcat, and the resulting El expression is parsed correctly.
Later, further information was found to:
This is a new feature of Jsp2.0:
II Introduction of Expression language (EL)
One of the main features of JSP 2.0 is that it supports the expression language (expression language). The JSTL expression language can easily access the implied objects and JavaBeans components of the JSP using the tag format, and the JSTL core tag provides process and loop control capabilities. Self-made tags also have the function of custom functions, so basically all seriptlet can be implemented by JSP instead. In JSP 2.0, it is recommended that you use El as much as possible to make the JSP format more consistent.
In Web.xml , you can control whether a set of JSPs uses El, and in each JSP you can specify whether the JSP uses El. The Iselignored property in page directive is used to specify whether to ignore. The format is:
<%@ page iselignored= "True|false"%>
If set to true, then the expressions in the JSP are treated as strings. For example, the following expression
${2000%}
is output to ${2000% 20} when iselignored= "true" and the output is 100 when "false" is iselignored=. The Web container defaults to iselignored= "false".
Although JSP 2.0 can make the JSP fully use the expression language and avoid scriptlet, in actual programming, should according to the function of the program requirements and the programmer's own conditions to choose the appropriate way. JSP with the expression language is convenient to be regular, but because the markup needs to be converted, it is slower when it is first invoked, and some programmers are more accustomed to the programming methods before JSP 1.2 because of their knowledge of Java, and therefore should choose the appropriate programming method in use.
That is, the default setting in Javaee4 is <%@ page iselignored= "false"%>, and the default setting in Javaee5 may be <%@ page iselignored= "true"%>, So in Javaee5 we can specify the normal parse El expression by setting the <%@ page iselignored= "false"%> in the JSP page .
The above JSP page in the El expression is treated as a string does not display the value of the problem of the solution is small series to share all the content, hope to give you a reference, but also hope that we support the cloud habitat community.