相关疑难解决方法(0)

无法找到速度模板资源

只是一个基于maven结构的简单速度独立应用程序.这是用Scala编写的代码片段,用于helloworld.vm${basedir}/src/main/resources文件夹中呈现模板:

com.ggd543.velocitydemo

import org.apache.velocity.app.VelocityEngine
import org.apache.velocity.VelocityContext
import java.io.StringWriter

/**
 * @author ${user.name}
 */
object App {

  def main(args: Array[String]) {
    //First , get and initialize an engine
    val ve = new VelocityEngine();
    ve.init();

    //Second, get the template
    val resUrl = getClass.getResource("/helloworld.vm")
    val t = ve.getTemplate("helloworld.vm");   // not work 
//    val t = ve.getTemplate("/helloworld.vm");  // not work
//    val t = ve.getTemplate(resUrl.toString);  // not work yet
    //Third, create a context and add data
    val context = new …
Run Code Online (Sandbox Code Playgroud)

java velocity scala

52
推荐指数
5
解决办法
9万
查看次数

标签 统计

java ×1

scala ×1

velocity ×1