File: README.txt

package info (click to toggle)
velocity 1.3.1-2
  • links: PTS
  • area: contrib
  • in suites: sarge
  • size: 4,164 kB
  • ctags: 2,922
  • sloc: java: 24,134; xml: 16,911; sh: 99; lisp: 53; makefile: 45
file content (114 lines) | stat: -rw-r--r-- 4,041 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
Welcome to Velocity!

As always, the if you have any questions :

1) Make sure you followed any directions :)  (did you build everything?)
2) Review documentation included in this package, or online at
      http://jakarta.apache.org/velocity
3) Ask on the velocity-user list.  This is a great source of support information.
   To join, read http://jakarta.apache.org/site/mail.html and then follow the 
   link at the bottom to join the lists.


servlet_example2
----------------
This is a slightly more complicated example of how Velocity can be used with
 your favorite servlet engine. To use this, you should have a basic understanding
how your servlet engine works, and how you deploy and access servlets to try this.
While we cannot supply this, we know of a good one :)
   http://jakarta.apache.org/tomcat/

The difference is that instead of self-configuring, the servlet SampleServlet2 will
use an external velocity.properties file specified in the web.xml deployment 
descriptor.

The example will demonstrate how to use either the FileResourceLoader to load a 
template from a subdirectory of your webapp, or the ClasspathResourceLoader to
load a template from a jar file placed in WEB-INF/lib.

This example assumes you have played with servlet_example1 and understand the basics.

1) Get a servlet engine.  Tomcat, from the Jakarta project, is an 
excellent implementation. (In fact, it's the official reference
implementation...)

2) Install said servlet engine.


Setting up to use the ClasspathResourceLoader
---------------------------------------------

3) Build this servlet example : in build - ant examples

4) Setup a webapp under tomcat :

 - make a new 'webapp' : in tomcat's webapps directory, 
   make a new directory structure as follows :
   
      velexample
      velexample/WEB-INF
      velexample/WEB-INF/lib
      velexample/WEB-INF/classes


 - put the velocity-1.1-rc1.jar (or newer) into the velexample/WEB-INF/lib directory
 
 - put the SampleServlet2.class into the velexample/WEB-INF/classes directory

 - put the templates.jar into the velexample/WEB-INF/lib directory.

 - put the web.xml into the velexample/WEB-INF directory

 - place a copy of velocity.properties.classloader, but rename to be velocity.properties

 - at this point, you should be able to restart tomcat and access the servlet.  

 - so bounce tomcat, go into your web brower and go to : 

    http://<your computer's ip address>:8080/velexample/servlet/SampleServlet

 - you should see the sample output.  

At this point, you are accessing the template via the ClasspathResourceLoader.  Note also
that the velocity.log will be placed in the velexample directory. (root of your webapp.)


Setting up to use the FileResourceLoader
----------------------------------------

3) Build this servlet example : in build - ant examples

4) Setup a webapp under tomcat :

 - make a new 'webapp' : in tomcat's webapps directory, 
   make a new directory structure as follows :
   
      velexample
      velexample/templates
      velexample/WEB-INF
      velexample/WEB-INF/lib
      velexample/WEB-INF/classes


 - put the velocity-1.1-rc1.jar (or newer) into the velexample/WEB-INF/lib directory
 
 - put the SampleServlet2.class into the velexample/WEB-INF/classes directory

 - put the sample.vm into the velexample/templates directory.

 - put the web.xml into the velexample/WEB-INF directory

 - place a copy of velocity.properties.fileloader, but rename to be velocity.properties

 - at this point, you should be able to restart tomcat and access the servlet.  

 - so bounce tomcat, go into your web brower and go to : 

    http://<your computer's ip address>:8080/velexample/servlet/SampleServlet

 - you should see the sample output.  

At this point, you are accessing the template via the FileResourceLoader.  Note also
that the velocity.log will be placed in the velexample directory. (root of your webapp.)