The el expression in the jsp file in maven project is invalid.
It was originally intended to write a small demo of springmvc. After the prototype was set up, it was ready to be used as a maven project, and the maven project was re-built. It started from here...
Maven uses web 2.3 by default to create a web project. the xml file header is also Version 2.3 .. to be honest, I didn't use maven to create a project before. Later I thought maven projects were too convenient to look at the source code, so I didn't care about it here .. the introduced version of javax-servlet-api 2.5. then we found that the el expressions in the jsp file are output as they are, and it seems that the el expressions are not parsed at all .. this is strange. Fortunately, there was an identical demo created by non-maven before, and there was no problem after running it again .. basically, the maven issue is locked, and the root cause of differentiation is also determined on the web 2.3 version ..
Then Baidu, basically the answer is: Before 2.5, web. in the header definition in the xml file, el expressions are ignored by default and are not parsed. Therefore, the expression declared for parsing el needs to be displayed. There are three solutions:
Solution 1: Add the following content to the jsp file header:
<%@ page isELIgnored="false" %>
Solution 2 is defined in the web. xml file as follows:
<jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <el-ignored>false</el-ignored> <scripting-invalid>true</scripting-invalid> </jsp-property-group></jsp-config>
Solution 3: Change the header in web. xml to version above 2.5 ..
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
These three solutions are indeed effective. I changed the header of web. xml to version 3.0 and ran OK again...