이클립스에서 작동하고 있습니다. 모든 Velocity Jar 파일을 Dynamic Web Project의 WEB-INF 폴더의 lib 디렉토리에 추가하기 만하면됩니다. 그런 다음 web.xml을 다음과 같이 업데이트하십시오.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Velocity_Test</display-name>
<welcome-file-list>
<welcome-file>index.vm</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<!-- Define Velocity template compiler -->
<servlet>
<servlet-name>velocity</servlet-name>
<servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</servlet-class>
</servlet>
<!-- Map *.vm files to Velocity -->
<servlet-mapping>
<servlet-name>velocity</servlet-name>
<url-pattern>*.vm</url-pattern>
</servlet-mapping>
</web-app>
부가 기능 관련 질문 lib 폴더에서 jar 파일을 제거하고 대신 클래스 경로에 추가했습니다. 그것은 많은 실수를 던졌습니다. 외부에서 모든 Velocity Jar 파일을 가리킬 수 있습니까, 아니면 이것을 작동시키기 위해 프로젝트의 lib 폴더로 파일을 가져와야합니까? 감사! – worked
속도 프로젝트의 예를 들어 주시겠습니까? 나는 하나를 세우고 싶지만 어려움을 겪고 있습니다. 파일을 어디서 볼 수 있도록 프로젝트 폴더를 공유 할 수 있습니까? 감사합니다. – deucalion0