Aaron Freeman wrote:
Ok, here's a stupid newbie question.
I have downloaded and installed the VelocityView tools as recommended. I placed the simple.war file into my webapps directory and I used the URL: http://<your_server>:<port>/simple/ as recommended by the documentation. And the website returned properly.
The question is ... how the heck did the VelocityView servlet (a) get called in the first place, and (b) know to dump index.vm? Neither index.vm or VelocityServlet are part of the URL ... and I don't understand the web.xml file.
a) This is the magic behind webapps in the servlet spec. Just by installing an application in the <tomcatHome>/webapp/<yourApp> it will locate the <tomcatHome>/webapp/<yourApp>/WEB-INF/web.xml and learn all about it.
Since the simple.war unpacks into the "simple" application, you were able to address it!
Now look into its web.xml, there is a servlet defined - I let you guess how its class is called! http://cvs.apache.org/viewcvs/jakarta-velocity-tools/examples/simple/WEB-INF/web.xml?rev=HEAD
b) Also in the web.xml there is a welcome-file-list defined. Here you can configure the files that are candidates of the parameterless invocation. For example you could set a "login.vm" in there...
The servlet specification (PDF downlaoded from SUNs site) states:
"If a Web container receives a valid partial request, the Web container
must examine the welcome file list defined in the deployment descriptor."Voil�: the servlet container will use the stated servlet to process the welcome-file-list file "init.vm".
Here is all you ever wanted to know about the web.xml file: http://developer.java.sun.com/developer/Books/javaserverpages/servlets_javaserver/servlets_javaserver05.pdf To find more about servlets: http://www.servlets.com/docs/index.html http://java.sun.com/products/servlet/resources.html
Cheers, Christoph
Aaron Freeman Layer-Z, Inc. Phone: (316) 729-9968 Fax: (215) 895-9813 [EMAIL PROTECTED] http://www.layerz.com/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- :) Christoph Reck
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
