On Thu, 31 Oct 2002, Andy Wickson wrote:

> Date: Thu, 31 Oct 2002 12:57:16 -0000
> From: Andy Wickson <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: packages
>
> Hi all,
>
> If I put a servlet called Hello.class into a package called
> com.myco.test and have a suitable dir structure under WEB-INF\classes to
> reflect this, do I still need to give the full URL of the class in the
> web.xml file e.g.,
>
>     <servlet-name>Hello</servlet-name>
>     <servlet-class>com.myco.test.Hello</servlet-class>
>
>     <servlet-mapping>
>     <servlet-name>Hello</servlet-name>
>      <url-pattern>com.myco.test.Hello</url-pattern>
>     </servlet-mapping>
>
> Also when referencing this servlet from an html form do I need to give
> the full URL?
>
> I've tried every combination I can think of.
>

The legal syntax for url patterns is defined in the servlet spec, but is
normally either a path match pattern ("/foo/*") or an extension match
pattern ("*.foo").  Note that the URL to be used does not need to have
anything to do with the name of the servlet class.  For example, if you
used the following servlet mapping:

  <servlet-mapping>
    <servlet-name>Hello</servlet-name>
    <url-pattern>/bar/*</url-pattern>
  </servlet-mapping>

and you install this webapp with a context path of "/foo", then you could
access this servlet with a URL like this, with the various parts of the
URL defined.

  http://localhost:8080/foo/bar/extra/path
                         ^   ^      \/
                         |   |       |
                         |   |       + Path info
                         |   |
                         |   +-------- Servlet path
                         |
                         +------------ Context path

> Regards
>
> Andy Wickson
>

Craig



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>

Reply via email to