My first servlet app is online

In this weblog entry, I talked about how to turn on the invoker servlet in Tomcat 5.0.28. I’ve received some advice since then from members of the Kansas City JUG telling me never to use the invoker servlet. In fact, even the JavaRanch page I referred to in the previous post had a link touting the evils of the invoker servlet. In addition, my KCJUG colleagues have assured me that registering each of my servlets with Tomcat through the web.xml file is simple.

So I did it. And it was easy.

My main beef now is with the text I’m following. All the examples so far in the book just drop the servlets into the default folder and use the invoker servlet to find them. In fact, there is no detailed explanation of web.xml and it’s features until Volume 2 of the book, which hasn’t even been published yet! (Actually, the first edition is published and available for free, but I’m still pissed!) I would think that there would be more about web.xml.

Anyway, I did get a sample application up on my website and coaxed the people at pointless waste of time to test it out. All it does is track clicks on links within a page, but I’m pretty happy with it as a first servlet application. I also got my redirect working so http://www.dangertree.net actually points to the index.php page (by default, Tomcat doesn’t recognize ‘index.php’ as a default page).

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. Posted June 21, 2006 at 1:08 am | Permalink

    Matt,

    Regarding your redirect to index.php, have you tried adding it to the “welcome-file-list” in your web.xml file? This might convince Tomcat to recognize it.

    Something like this…

    index.php

  2. Posted June 21, 2006 at 1:11 am | Permalink

    It looks like my web.xml snippet didn’t work the first time. Here it is again…

    <web-app>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    </web-app>

  3. Posted June 21, 2006 at 7:31 am | Permalink

    That brings up another question.

    I don’t have a “WEB-INF” folder on my root public_html because I don’t have any servlets running on that domain yet (only on test.dangertree.net). Obviously when the “index.jsp” file is converted into a servlet it is not stored with my classes that would reside in “WEB-INF/classes”. Tomcat must have an internal location to store those classes, right?

    So I can just create a “WEB-INF/web.xml” file and Tomcat will read it when it starts up even if there are no servlet classes? And no “classes” folder?

    Also, thanks for dropping by, Troy. You missed the drawing for the iPod Nano. (Fred got it.)

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*
Check out the latest GroovyMag to see an interview with me about the 1.1 release of GrailsUI: