spring mvc + jsp jstl不能正确显示,输出表达式

spring mvc + jsp jstl不能正确显示,输出表达式

1. 使用JSP 1.2 定义格式

web.xml 配置
<!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>

这种情况下, EL表达式默认是禁用或者忽略的, 必须手动启用,才会输出 model 中的值。

其中使用了 <%@ page isELIgnored=“false” %> 来开启 EL 表达式;如下:

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

###2. 使用JSP 2.0 定义格式

web.xml 配置

<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. 更新的 Servlet 3.1 规范(也没有 DTD 定义)

//…

猜你喜欢

转载自blog.csdn.net/zhaojunjie_cc/article/details/89448302