关于使用springMVC时model.addAttribute("list",list)jsp页面无法使用EL表达式获取到值

    xiaoxiao2021-03-25  125

    方法一

    isELIgnored默认是true,改成<%@ page isELIgnored="false" %>,但每创建一个页面都需要添加此属性,也可放在共用jsp中用<%@include file=""%>

    添加进页面

    方法二

    web.xml中加上,简单,但是还不是好的解决办法。

    <jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <el-ignored>false</el-ignored> </jsp-property-group> </jsp-config>

    方法三

    将项目的WEB-INF下的web.xml文件修改

    在默认情况下,Servlet 2.3 / JSP 1.2是不支持EL表达式的,而Servlet 2.4 / JSP 2.0及更高版本支持El表达式

    这里是servlet3.1.0版本

    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">

    转载请注明原文地址: https://ju.6miu.com/read-33768.html

    最新回复(0)