John:
This is indeed very helpful. Somehow after I reboot the NT the example is
working.
If it is of some value, I have re-written the documentation for
servlet_example2 as follows:
==================================================================================================================
Welcome to Velocity!
source: README.txt from the \velocity-X\examples\servlet_example2 directory
(where X is the version e.g. 1.3)
As always, the if you have any questions :
1) Make sure you followed any directions :) (did you build everything?
particularly ant jar, ant jar-dep, ant examples)
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/templates
velexample/WEB-INF
velexample/WEB-INF/lib
velexample/WEB-INF/classes
- put the velocity-X.jar and velocity-dep-X.jar (X is the version e.g.
-1.3) into the velexample/WEB-INF/lib directory
- put the SampleServlet2.class into the velexample/WEB-INF/classes
directory
- put the templates.jar (generated after the ant build) 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 into velexample/
- 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/SampleServlet2
- you should see the sample output.
- if you get a 404, page not found, try editing /tomcat/conf/web.xml and
remove the comments around
<!-- The mapping for the invoker servlet -->
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
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.)
===================================================================================================================
Regards,
[EMAIL PROTECTED]
NCCI
Boca Raton, Florida
561.893.2415
greetings / avec mes meilleures salutations / Cordialmente
mit freundlichen Gr��en / Med v�nlig h�lsning
"John Doe"
<[EMAIL PROTECTED] To: "Velocity Users List"
<[EMAIL PROTECTED]>
il.com> cc:
Subject: Re: [velocity - newbie]
servlet_example2 blank page
07/16/2003 09:51
AM
Please respond to
"Velocity Users
List"
I had the same problems as you, I'm still a newbie myself but the attached
link helped me a lot, hope it would help you too.
http://www.cymulacrum.net/tomcat/tomcat_toc.html
Regards
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 16, 2003 3:22 PM
Subject: [velocity - newbie] servlet_example2 blank page
I am brand new to this list and to velocity. I installed velocity and
wanted to try the servlet examples to make sure my installation was
working. I found a couple of problems with the instructions:
1) rename volocity.properties.classloader to velocity.properties must be
copied to the .../velexample subdirectory (no stated where it goes).
2) I had to uncomment in /tomcat/conf/web.xml the section containing:
>invoker< ... >/servlet/*< (I was getting a 404 page not found)
3) there is no such thing as "volocity-1.1-rc1.jar", I could only find the
"velocity-1.3.jar"
4) the place to go in the browser is
http://127.0.0.1:8080/velexample/servlet/SampleServlet2 (notice the 2 at
the end, I was getting a 404 again)
However, I still get a blank page and no signs of the "velocity.log" that I
was suppose to find (searched the entired /tomcat/ directory).
I beg you all to be gentle and focus on the issue. How do we get newcomers
up and running so the velocity experience feels great right from the
beginning.
Regards,
[EMAIL PROTECTED]
NCCI
Boca Raton, Florida
561.893.2415
greetings / avec mes meilleures salutations / Cordialmente
mit freundlichen Gr��en / Med v�nlig h�lsning
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]