zoukankan      html  css  js  c++  java
  • 解决org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource

    spring中做成bean,可以使用property"resourceLoaderPath"指定工程中的路径

    <bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
    <property name="resourceLoaderPath" value="/WEB-INF/classes/templet" />
    <property name="velocityProperties">
    <props>
    <prop key="velocimacro.library">*.vm</prop>
    <prop key="default.contentType">text/html; charset=utf-8</prop>
    <prop key="output.encoding">utf-8</prop>
    <prop key="input.encoding">utf-8</prop>
    </props>
    </property>
    </bean>
    
    如果是new velocityEngine的实例,例如用在test中
    可以这样指定路径
    VelocityEngine velocityEngine = new VelocityEngine();
    Properties p = new Properties();
    p.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, "E:/reyo/project/WEB-INF/classes/templet");
    velocityEngine.init(p);
    
  • 相关阅读:
    网页游戏中PK系统的实现
    操作系统面试题
    9.26<立方网>技术笔试题
    cocos2d-x游戏之2048
    适配器模式
    工厂模式的三种形式
    面向对象设计的几大原则
    数据库的优化
    @RequestBody的使用
    vue.js小记
  • 原文地址:https://www.cnblogs.com/interdrp/p/5048093.html
Copyright © 2011-2022 走看看