📄 readme.txt
字号:
This is the example code for the JavaWorld article "Start up the Velocity Template Engine"HelloWorld.java===============This is a simple program to show the basics of rendering atemplate using Velocity.To compile, add the included velocity-dep-1.2.jar to yourclasspath, and then $ javac HelloWorld.javaTo run the program, make sure that the template "helloworld.vm"is in the same directory, and then $ java HelloWorldand you should see the output.PetStoreEmail.java==================This program is like HelloWorld, but adds different data tothe context.You would build the same way, with the Velocity jarin the classpath $ javac PetStoreEmail.javaNow, to run, there are three example tempaltes included, onefor each example given in the article - plain text, HTML output, and XML output.The corresponding templates are petstoreemail_plain.vm petstoreemail_html.vm petstoreemail_xml.vmTo run, choose one of the templates above and make a copy ofit named 'petstoreemail.vm'. For example to see the HTMLoutput $ cp petstoreemail_html.vm petstoreemail.vmunder unix (or Mac OS X :) or $copy petstoreemail_html.vm petstoreemail.vmunder the Windows command prompt.Then, you can just run the program $java PetStoreEmailFor fun, you might try to modify the program to take the template name as an argument to the program.Sample.java===========To try the servlet example, I included a complete WARfile that has been tested under Jakarta Tomcat. It should work fine under most servlet containers.The following assumes a basic understanding of Tomcat and a standard configuration.To deploy under Tomcat, just drop the WAR file into theTomcat webapps directory, and restart Tomcat.Then, point your browser at http://localhost:8080/velocity/servlet/Sampleand you should see the HTML output generated byVelocity in your browser.If you have any questions about these examples, don't hesitate to contact me.If you have questions or more interest about Velocity, please join us on the Velocity users list for discussion.To subscribe, please read this page http://jakarta.apache.org/site/mail.htmland follow the link at the bottom (of tha page.)There you can subscribe to the Velocity user and developer lists. All are welcome.geir
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -