我们在Spring 3.0.5上运行Tomcat 6.0,由于某种原因,我们无法通过jsps来评估$ {blah}。这是一个Maven项目,有很多单独的模块,如果需要的话,Eclipse Helios。
这是我的web.xml的片段
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>xc.rio</display-name>...
这不是(<%@ page isELIgnored =“ false”%>),因为当我将其放入jsp时,页面仅显示为文本,这意味着
<%@ page isELIgnored="false" %> <HTML> ...${blah}...
$ {2 + 2}未评估。我也在tomcat 7上尝试过这个。=-(
更新:我已经完成了独立的spring和nonspring应用程序以及EL的工作。我以为它与viewResolver有关,但是我猜不是。
<?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:mvc="http://www.springframework.org/schema/mvc" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xmlns:camel="http://camel.apache.org/schema/spring" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> <mvc:annotation-driven /> <bean id="handlerMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"> <property name="detectHandlersInAncestorContexts" value="true" /> </bean> <mvc:default-servlet-handler/> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="suffix" value=".jsp"/> </bean> </beans>
尝试删除<mvc:default-servlet-handler/>导致spring将页面用作静态资源的。
<mvc:default-servlet-handler/>