什么是用于创建文本文件的java模板引擎/ api?

Leo*_*eon 7 java templates text-files

我想在基于java的Web应用程序中创建不同格式的文件.这些文件是纯文本文件,没有任何html标签.但是文件需要某种格式,文本在左侧,中间,右侧或文件中的某个位置(制表符,空格).

带有占位符的模板+带有data = text文件的java bean.

什么java模板引擎或api适合这个?

谢谢!

Eld*_*ael 4

您可以查看字符串模板GitHub)。

它看起来像这样:

import org.antlr.stringtemplate.*;
import org.antlr.stringtemplate.language.*;

StringTemplate hello = new StringTemplate("Hello, $name$", DefaultTemplateLexer.class);
hello.setAttribute("name", "World");
System.out.println(hello.toString());
Run Code Online (Sandbox Code Playgroud)