spring mvc + jsp jstl cannot be displayed correctly, output expression

spring mvc + jsp jstl cannot be displayed correctly, output expression

1. Use JSP 1.2 to define the format

web.xml configuration
<!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>
 //...
</web-app>

In this case, the EL expression is disabled or ignored by default, and must be manually enabled before the value in the model is output.

Which uses <%@ page isELIgnored="false" %> to turn on the EL expression; as follows:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
  <head>
   <%@ page isELIgnored="false" %>
 </head>
  <body>
   	${msg}
  </body>
</html>

###2. Use JSP 2.0 to define the format

web.xml configuration

<web-app id="WebApp_ID" 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">
//...
</web-app>

###3. Updated Servlet 3.1 specification (and no DTD definition)

//...

Guess you like

Origin blog.csdn.net/zhaojunjie_cc/article/details/89448302