OK - let me try to make this as clear as possible.
Other than the information I provided below, here is what happens.
HTML page says:  <FORM ACTION="coreservlets.ShowParameters".  This HTML form
is in $TOMCAT_HOME/webapps/book.
So, when the URL says http://localhost/book/form.html, I get the form with
no problem, as Apache knows where this is located.  However, when I click on
the 'Submit' button, I get the 404.  Right now the servlet is located in
$TOMCAT_HOME/webapps/book/coreservlets/.  Isn't that the right place?
Thanks.

----- Original Message -----
From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, September 09, 2001 9:20 PM
Subject: Re: newbe: class directory question


>
>
> On Sun, 9 Sep 2001, Charles Webber wrote:
>
> > Date: Sun, 9 Sep 2001 20:58:00 -0700
> > From: Charles Webber <[EMAIL PROTECTED]>
> > Reply-To: [EMAIL PROTECTED]
> > To: [EMAIL PROTECTED]
> > Subject: Re: newbe: class directory question
> >
> > Thanks Craig - here is some more detailed info:
> > web.xml file does contain a <servlet-mapping> section.  The name of the
> > servlet is ShowParameters, which is part of a package called
coreservlets.
> > The web.xml file contains the following:
> > <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app
> >     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> >     "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>
> > <web-app>
> >   <servlet>
> >     <servlet-name>ShowParameters</servlet-name>
> >     <servlet-class>coreservlets.ShowParameters</servlet-class>
> >   </servlet>
> >   <servlet-mapping>
> >     <servlet-name>ShowParameters</servlet-name>
> >     <url-pattern>/book</url-pattern>
> > </web-app>
> >
> > The server.xml file contains the following in the context section:
> >  <Context path="/book"
> >                  docBase="webapps/book"
> >                  crossContext="false"
> >                  debug="0"
> >                  reloadable="true" >
> >         </Context>
> >
> > My HTML file contains a form, and the action is
> > "/book/coreservlets.ShowParameters".
> >
> > However, the submit button doesn't point Tomcat to the correct place, as
the
> > servlet isn't found.
> > Any suggestions?  Any other questions?
> > Thanks
> >
>
> Since you *still* didn't say what URL you were trying to submit to :-), I
> will make an assumption.
>
> The correct URL for the "book" servlet would be:
>
>   http://localhost:8080/book/book
>
> because you're using "/book" both as the context path *and* as the servlet
> path.  URL patterns in <servlet-mapping> entries are relative to the
> context path of the web application, not from the base of th server.
>
> See the servlet spec for more information.
>
> Craig
>
>
> > ----- Original Message -----
> > From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Sunday, September 09, 2001 5:31 PM
> > Subject: Re: newbe: class directory question
> >
> >
> > >
> > >
> > > On Sun, 9 Sep 2001, Charles Webber wrote:
> > >
> > > > Date: Sun, 9 Sep 2001 17:30:28 -0700
> > > > From: Charles Webber <[EMAIL PROTECTED]>
> > > > Reply-To: [EMAIL PROTECTED]
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: newbe: class directory question
> > > >
> > > > Ok - I have basically the same question when it comes to Servlets.
I've
> > > > created the proper directory structure for a new web application
under
> > > > $TOMCAT_HOME/webapps, placed a new context in server.xml,
> > >
> > > You don't actually have to do this, if the directory is under
"webapps" --
> > > Tomcat will recognize it automatically.
> > >
> > > > and created a
> > > > web.xml file pointing to the servlet class, but still I can't find
it
> > > > without using /servlet/ as part of my URL.  How come?
> > > >
> > >
> > > Have you got a <servlet-mapping> in your /WEB-INF/web.xml file?
> > >
> > > The only way to solve problems like this is details - please post the
> > > directory structure and its contents, the contents of the web.xml
file,
> > > and the URL you are trying.  Otherwise, there's no hope of helping you
> > > figure out where you haven't got things quite right.
> > >
> > > Craig
> > >
> > >
> > > > ----- Original Message -----
> > > > From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Sunday, September 09, 2001 3:21 PM
> > > > Subject: Re: newbe: class directory question
> > > >
> > > >
> > > > >
> > > > >
> > > > > On Sun, 9 Sep 2001, Bo Xu wrote:
> > > > >
> > > > > > Date: Sun, 09 Sep 2001 18:11:11 -0400
> > > > > > From: Bo Xu <[EMAIL PROTECTED]>
> > > > > > Reply-To: [EMAIL PROTECTED]
> > > > > > To: [EMAIL PROTECTED]
> > > > > > Subject: Re: newbe: class directory question
> > > > > >
> > > > > > [EMAIL PROTECTED] wrote:
> > > > > >
> > > > > > > Hi everyone,
> > > > > > >
> > > > > > > I have a question about the directory structure, or maybe a
> > question
> > > > about
> > > > > > > servlets themselves; I'm not sure yet.
> > > > > > >
> > > > > > > 1) Does every class file that I'm going to be using have to be
in
> > the
> > > > > > > WEB-INF\classes directory while using Tomcat?
> > > > > > > 2) Do all JSP/Servlet servers/containers have this directory?
> > > > > > >
> > > > > > > THE chad
> > > > > >
> > > > > > only for your first question :-)
> > > > > >
> > > > > > * class can be put in:
> > > > > >     - WEB-INF/classes
> > > > > >           or
> > > > > >     - $CATALINA_HOME/classes
> > > > > >           or
> > > > > >     - $CATALINA_HOME/common/classes
> > > > > >
> > > > > >
> > > > > > * jar can be put in:
> > > > > >     - WEB-INF/lib
> > > > > >          or
> > > > > >     - $CATALINA_HOME/lib
> > > > > >           or
> > > > > >     - $CATALINA_HOME/common/lib
> > > > > >
> > > > > >
> > > > > > good email for you :-)
> > > > > >
> > > > >
> > > > > Just a caution, related to your second question.
> > > > >
> > > > > All servlet containers supporting the Servlet 2.2 or 2.3 specs do
> > indeed
> > > > > support unpacked classes in WEB-INF/classes, or JAR'd classes in
> > > > > WEB-INF/lib.  This is defined in the servlet specification, which
can
> > be
> > > > > downloaded from:
> > > > >
> > > > >   http://java.sun.com/products/servlet/download.html
> > > > >
> > > > > and makes useful reading in order to understand what is portable
and
> > what
> > > > > is not.
> > > > >
> > > > > Most containers provide mechanisms to make classes available to
all
> > web
> > > > > applications, but this is *not* standardized, or even guaranteed
to be
> > > > > available.
> > > > >
> > > > > Craig
> > > > >
> > > >
> > > >
> > >
> >
> >
>

Reply via email to