spring mvc整合freemarker基于注解方式配置文件报错

wenwen1 发布于 2013/05/10 21:46
阅读 1K+
收藏 0

我的test-web-context.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:tx="http://www.springframework.org/schema/tx" 
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:jee="http://www.springframework.org/schema/jee" 
xmlns:context="http://www.springframework.org/schema/context"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:security="http://www.springframework.org/schema/security"
     xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans 
  http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
      http://www.springframework.org/schema/aop 
       http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
  http://www.springframework.org/schema/tx
  http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
  http://www.springframework.org/schema/context
  http://www.springframework.org/schema/context/spring-context-3.1.xsd
  http://www.springframework.org/schema/jee
  http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
  http://www.springframework.org/schema/lang
       http://www.springframework.org/schema/lang/spring-lang-3.1.xsd
       http://www.springframework.org/schema/mvc
       http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
       http://www.springframework.org/schema/security
       http://www.springframework.org/schema/security/spring-security-3.1.xsd">






 
  <!-- ******************************************************************** -->
<!-- Spring 3.0 configuration -->
<!-- ******************************************************************** -->
  <mvc:annotation-driven/>

<!-- Allows for mapping the DispatcherServlet to "/" by forwarding static resource requests to the container's default Servlet -->
<mvc:default-servlet-handler/>

<!-- ******************************************************************** -->
<!-- Mark bean transactions as annotation driven -->
<!-- ******************************************************************** -->
<tx:annotation-driven transaction-manager="transactionManager" />

  <!-- ******************************************************************** -->
<!-- Register Multi Part Resolve -->
<!-- ******************************************************************** -->
<bean id="multipartResolver" class="org.skyway.spring.util.web.binary.ModelBindingMultipartResolver" />

<!-- ******************************************************************** -->
<!-- Register Streamed Binary Content View -->
<!-- ******************************************************************** -->
<bean id="streamedBinaryContentView" class="org.skyway.spring.util.web.binary.ModelAttributeStreamer" />

<!-- ******************************************************************** -->
<!-- Bean Name View Resolver used to Redirect to Beans by id, required by Binary Content View -->
<!-- ******************************************************************** -->
<bean id="beanNameViewResolver" class="org.springframework.web.servlet.view.BeanNameViewResolver" />

<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/WEB-INF/pages/" />
</bean>
<bean id="freemarkerConfig"  class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
        <property name="templateLoaderPath" value="/WEB-INF/view/" />
        <property name="freemarkerSettings">
            <props>
                <prop key="template_update_delay">0</prop>
                <prop key="default_encoding">UTF-8</prop>
                <prop key="number_format">0.##########</prop>
                <prop key="datetime_format">yyyy-MM-dd HH🇲🇲ss</prop>
                <prop key="classic_compatible">true</prop>
                <prop key="template_exception_handler">ignore</prop>
            </props>
        </property>
    </bean>
    <!-- 针对freemarker的视图配置 -->
    <bean id="freemarkerViewResolver"
        class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
        <property name="cache" value="true" />
        <property name="prefix" value="" />
        <property name="suffix" value=".ftl" />
        <property name="contentType" value="text/html;charset=UTF-8"></property>
        <property name="requestContextAttribute" value="request" />
        <property name="exposeSpringMacroHelpers" value="true" />
        <property name="exposeRequestAttributes" value="true" />
        <property name="exposeSessionAttributes" value="true" />
    </bean>
<bean id="iPhoneUserAgentViewResolver" class="org.skyway.spring.util.viewresolution.UserAgentViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
        <property name="agentSubstring" value="iPhone" />
        <property name="prefix" value="/WEB-INF/iphone/" />
        <property name="order" value="0" />
    </bean>


<bean id="webInfViewResolver" class="org.skyway.spring.util.viewresolution.AbsolutePathViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
        <property name="order" value="-1" />
    </bean>
    
<!-- ******************************************************************** -->
<!-- Scan for web layer annotated beans -->
<!-- ******************************************************************** -->
<context:component-scan base-package="net.gvsun.web" scoped-proxy="interfaces" />
</beans>

报如下错误:

Build path is incomplete. Cannot find class file for freemarker/ext/jsp/TaglibFactory

这该怎么办啊?

加载中
0
Beyond-Bit
Beyond-Bit
freemarker/ext/jsp/TaglibFactory  没有找到该依赖库啊!找个这个jar加进去!
0
飘逸的逸
飘逸的逸

你看看你下载的freemarker.jar中是否所有这个class : freemarker/ext/jsp/TaglibFactory


返回顶部
顶部