1.修改编码格式
input.encoding=UTF-8
output.encoding=UTF-8
2.首选文件系统访问velocity.preferFileSystemAccess=true
3.资源加载程序velocity.resourceLoaderPath=/WEB-INF/views/
4.后缀velocity.suffix=.vm
5.resource.loader = globbing,string全局;字符串
6.Velocity在生成模板时,会出现多余的空白和空白行,下面给出2种处理方式:
1. velocity指令之间不要缩进,但是可以换行,在每行后面增加 ## 单行注释指令让velocity引擎放弃解析后面的内容:
#foreach($u in $list) ##
#if()##
<li>$u.title</li>##
#end##
#end
2. 使用 StructuredGlobbingResourceLoader
resource.loader = globbing,string
globbing.resource.loader.class = StructuredGlobbingResourceLoader
string.resource.loader.class = org.apache.velocity.runtime.resource.loader.StringResourceLoader
input.encoding=UTF-8
output.encoding=UTF-8
2.首选文件系统访问velocity.preferFileSystemAccess=true
3.资源加载程序velocity.resourceLoaderPath=/WEB-INF/views/
4.后缀velocity.suffix=.vm
5.resource.loader = globbing,string全局;字符串
6.Velocity在生成模板时,会出现多余的空白和空白行,下面给出2种处理方式:
1. velocity指令之间不要缩进,但是可以换行,在每行后面增加 ## 单行注释指令让velocity引擎放弃解析后面的内容:
#foreach($u in $list) ##
#if()##
<li>$u.title</li>##
#end##
#end
2. 使用 StructuredGlobbingResourceLoader
resource.loader = globbing,string
globbing.resource.loader.class = StructuredGlobbingResourceLoader
string.resource.loader.class = org.apache.velocity.runtime.resource.loader.StringResourceLoader