我正在使用速度
VelocityContext context = new VelocityContext();
context.put("commentText", commentText);
context.put("link", link);
当我放置commentText
时,将保留空白等格式。
但是在邮件正文中,我只有一行文字。我不确定应该在哪里以及如何维护格式和换行符。
StringWriter w = new StringWriter();
Template t = Velocity.getTemplate("AcceptMilestone.html");
System.out.println("after Velocity . get template ;;;;;;;;;");
t.merge(context, w);
System.out.println("after Velocity . merge content ;;;;;;;;;");
String s = w.toString();