Struts2采用velocity作为view后,增加新的vm模板查找路径
作为记号,怕搞忘:
?
struts2的velocity引擎一般会以web根路径作为vm默认查找路径。如:#parse("/xx.vm"),则会到实际运行的web根目录下查找该文件。如果想增加外面的vm模板引用,则必须要更改velocity配置文件。
?
在velocity.peroperties中增加选项:
resource.loader=strutsfile, strutsclass, filefile.resource.loader.path=/home/vm?其中,resource.loader表示定义了velocity资源装载的方式。struts2中默认为strutsfile和strutsclass,需要增加:file