tech_memo / velocity


tech_memo

vmファイルをresource配下から読む方法

  1. velocity.propertiesに以下の記述をしておく
    resource.loader = class
    class.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
  2. ソースの中で、init処理で上記velocity.propertiesを読み込ませる。getResouce()で読むこと。
    Velocity.init(this.getClass().getResource("/velocity.properties").getPath());
  3. vmファイルの読み込みには、getResource()を使わない。
    Template template = Velocity.getTemplate("velocity/templates/sample.vm")

最新の20件

2023-01-26 2022-11-11 2022-03-02 2022-02-03 2021-11-18 2021-11-11 2021-10-27 2021-10-04 2021-09-30 2021-08-24 2021-04-01 2021-02-25 2020-08-13 2020-05-22 2020-04-16 2020-04-15 2020-03-23 2020-03-12 2020-02-27

今日の3件

  • counter: 205
  • today: 1
  • yesterday: 0
  • online: 1