开发者社区 问答 正文

spring mvc整合velocity,为什么页面上的变量不能正常显示

这是在*-servlet.xml中的velocity的配置:

<!-- velocity配置 -->
    <bean id="velocityConfigurer"
        class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
        <property name="resourceLoaderPath" value="/WEB-INF/views/" />
        <property name="velocityProperties">
            <props>
                <prop key="input.encoding">UTF-8</prop>
                <prop key="output.encoding">UTF-8</prop>
            </props>
        </property>
    </bean>
 
    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
        <property name="cache" value="false" />
        <property name="suffix" value=".html" />
        <property name="contentType" value="text/html; charset=UTF-8" />
         <property name="exposeSpringMacroHelpers" value="true" />
 
    </bean>

screenshot

展开
收起
a123456678 2016-03-16 10:41:33 2696 分享 版权
1 条回答
写回答
取消 提交回答
  • el表达式jsp页面加上<%@ page isELIgnored="false"%>

    2019-07-17 19:03:33
    赞同 展开评论