我尝试使用centos7上的速度引擎渲染一些 .vm 文件。我已经下载了 velocity-engine-core-2.0.jar ,但我不知道该如何处理这个jar文件,我应该如何使用它来配置tomcat以便能够渲染.vm文件。我没有太多的java知识,只需要渲染这些视图,这样我就可以在样式表中进行一些更改。
这是我的资产结构:
/css/
/images/
/views/ (.vm files are here)
/file1.properties
/file2.properties
答案 0 :(得分:0)
您可能需要在web.xml中保留如下所示的映射:
<web-app>
<servlet>
<servlet-name>velocity</servlet-name>
<servlet-class>org.apache.velocity.tools.view.VelocityViewServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>velocity</servlet-name>
<url-pattern>*.vm</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.vm</welcome-file>
</welcome-file-list>
</web-app>