>Web.xml contains:
>
[quoted text clipped - 11 lines]
> </servlet-mapping>
></web-app>
ok, nothing wrong with this, as long as:
1. the class (full class name, including any packages) is testme.class
2. Any URL with the pattern http://yourserver/servlet/* will be
directted to your server.
>Created two simple hello java programs called "testme" and "abc123"
>and put them under the "classes" directory. Had my URL pointer to
[quoted text clipped - 3 lines]
>testme? Is there a way to set Tomcat so Tomcat will execute the any
>classes from the URL?
Yes, because that's what you specified above.
You need 2 servlet declarations, such as:
<web-app>
<servlet>
<servlet-name>testme</servlet-name>
<servlet-class>testme</servlet-class>
</servlet>
<servlet>
<servlet-name>abc123</servlet-name>
<servlet-class>abc123</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>testme</servlet-name>
<url-pattern>/servlet/testme</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>abc123</servlet-name>
<url-pattern>/servlet/abc123</url-pattern>
</servlet-mapping>
</web-app>
>1. Isn't servlet-name is just any name you give assign??
Yes, servlet-name is a reference to a servlet. You use that same name
in servlet-mapping, etc.
>2. Servlet-class is the a test class program locate in the classes
>directory so Tomcat knows where to look for all others???
No. servlet-class is the class name of the servlet.
>3. url-pattern is the specify the URL pattern to expected return???
No. url-pattern is the URL that is used by the servlet container
(Tomcat) to know when to call your servlet.
>I am so confuse ...
I'd suggest finding some servlet tutorials.
--
now with more cowbell
Hai Tran - 30 Mar 2004 22:54 GMT
Bryce - Thank you so much for your help and clarification. To sum from
what you have said. I have to declare every servlet programs that will
be called in the web.xml file? Isn't there a dynamic or better way
other then declaring each servlet to be call?
Also, I've did purchase a book called "JSP, Servlets, and MYSQL by
David Harms" but it briefly mention it. Do you have other book
suggestion?
> >Web.xml contains:
> >
[quoted text clipped - 67 lines]
>
> I'd suggest finding some servlet tutorials.
Bryce (Work) - 31 Mar 2004 15:15 GMT
>Bryce - Thank you so much for your help and clarification. To sum from
>what you have said. I have to declare every servlet programs that will
>be called in the web.xml file? Isn't there a dynamic or better way
>other then declaring each servlet to be call?
Yes, each servlet must be declared in the web.xml file (as far as I
know). No, there is no dynamic way.
>Also, I've did purchase a book called "JSP, Servlets, and MYSQL by
>David Harms" but it briefly mention it. Do you have other book
>suggestion?
I don't know that book. I use the O'Reilly book "Java Servlet
Programming".
--
now with more cowbell