JSP表达式语言不起作用

ski*_*kip 1 jsp spring-mvc spring-3

我无法${}在我的.jsp页面上运行表达式.

displayAllCustomers.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>


<html>
    <body>
        <h3>Our Entire Customer Database</h3>
        <ul>
            <c:forEach items="${allCustomers}" var="customer">
                <li>${customer.name}</li>
            </c:forEach>
        </ul>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

调度员servlet.xml中

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
                                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                                      http://www.springframework.org/schema/tx
                                      http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
                                      http://www.springframework.org/schema/aop 
                                      http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

    <import resource="applicationContext.xml"/>     

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/views/" />
        <property name="suffix" value=".jsp" />
    </bean>


    <bean name="/displayAllCustomers" class="mypackage.DisplayAllCustomersController">
        <property name="customerManagementService" ref="customerManagementService" />
    </bean>     

</beans>
Run Code Online (Sandbox Code Playgroud)

DisplayAllCustomersController.java

public class DisplayAllCustomersController {

    private CustomerManagementService customerManagementService;
    public void setCustomerManagementService(CustomerManagementService customerManagementService) {
        this.customerManagementService = customerManagementService;
    }

    @RequestMapping("/displayAllCustomers")
    public ModelAndView displayAllCustomers() {
        List<Customer> allCustomers = customerManagementService.getAllCustomers();
        return new ModelAndView("displayAllCustomers", "allCustomers", allCustomers);
    }
}
Run Code Online (Sandbox Code Playgroud)

当我显示页面时,我只显示标题"我们的整个客户数据库".

它让我疯狂,我无法弄清楚我错过了什么.

有人可以帮我理解为什么会这样吗?

非常感谢.

Pet*_*nto 6

将以下内容添加到顶部

<%@ page isELIgnored="false"%>
Run Code Online (Sandbox Code Playgroud)


Tec*_*nch 5

我遇到了一些问题,上述解决方案有效.但是问题是什么?我运行另一个项目,但我不做这个导入.但它仍然可以正常工作.

我指的是这个解决方案:

    <%@ page isELIgnored="false"%>
Run Code Online (Sandbox Code Playgroud)