未处理Spring和JSP EL [英] Spring and JSP EL not being processed

查看:62
本文介绍了未处理Spring和JSP EL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在运行带有Spring 3.0.5的Tomcat 6.0,由于某种原因,我们无法通过jsps来评估$ {blah}.这是一个Maven项目,有很多单独的模块,如果需要的话,Eclipse Helios.

We are running Tomcat 6.0 with Spring 3.0.5 an for some reason we can not get the jsps to evaluate the ${blah}. This is a maven project with many separate modules if that matters, Eclipse Helios.

这是我的web.xml的一部分

Here is a snipped of my 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时,页面仅以文本形式呈现

And it isn't this (<%@ page isELIgnored="false" %>) because when I put this in my jsp the page is rendered as text only meaning

<%@ page isELIgnored="false" %>
<HTML>
...${blah}...

$ {2 + 2}不被评估.我也在tomcat 7上尝试过这个.=-(

${2+2} is not evaluated. Also I have tried this on tomcat 7. =-(

更新: 我已经完成了独立的spring和nonspring应用程序以及EL的工作.我以为它与viewResolver有关,但是我猜不是.

Update: I have done a standalone spring and nonspring app and EL works. I was thinking it had something to do with the viewResolver, but that isn't it either I guess.

<?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将页面作为静态资源提供服务.

Try removing the <mvc:default-servlet-handler/> that causes spring to serve up pages as a static resources.

这篇关于未处理Spring和JSP EL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆