You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by James Adams <ja...@ucar.edu> on 2001/09/26 09:58:43 UTC
How to make a URL map to a servlet ?
I have a servlet which looks at the request, makes sure that there is a
Session and the necessary beans included in the Session and then directs
to a JSP page. I want to be able to enter a URL and get the servlet
(which will direct me to the JSP).
I have the JSP in $TOMCAT_HOME/webapps/myapp/Myapp.jsp and the servlet
in $TOMCAT_HOME/webapps/myapp/WEB-INF/classes/Servlet.
Can anyone tell me how I can set things up so that I can enter a URL and
get the servlet to run ? I have tried using URL's such as
http://myserver.my.domain:8080/myapp/Servlet and
http://myserver.my.domain:8080/myapp/servlet/Servlet but these don't
appear to work. I'm stumped.
I'm running Tomcat version 3.2.1-1, the OS is Red Hat 7.0.
Thanks in advance for any suggestions or insight. Please Cc:
jadams@ucar.edu if you can.
-James
Re: How to make a URL map to a servlet ?
Posted by James Adams <ja...@ucar.edu>.
One other thing, my web.xml file is located as
$TOMCAT_HOME/webapps/myapp/WEB_INF/web.xml and not as /etc/web.xml - is this
perhaps where I've gone wrong ?
-James
Lester June Cabrera wrote:
> Hi James,
>
> Tomcat is bundled with a "build" utility. By editing /etc/web.xml in your
> development directory, you should be able to map your servlet class to your
> desired URL.
>
> Lester
>
> At 01:58 AM 9/26/01 -0600, you wrote:
> >I have a servlet which looks at the request, makes sure that there is a
> >Session and the necessary beans included in the Session and then directs
> >to a JSP page. I want to be able to enter a URL and get the servlet
> >(which will direct me to the JSP).
> >
> >I have the JSP in $TOMCAT_HOME/webapps/myapp/Myapp.jsp and the servlet
> >in $TOMCAT_HOME/webapps/myapp/WEB-INF/classes/Servlet.
> >
> >Can anyone tell me how I can set things up so that I can enter a URL and
> >get the servlet to run ? I have tried using URL's such as
> >http://myserver.my.domain:8080/myapp/Servlet and
> >http://myserver.my.domain:8080/myapp/servlet/Servlet but these don't
> >appear to work. I'm stumped.
> >
> >I'm running Tomcat version 3.2.1-1, the OS is Red Hat 7.0.
> >
> >Thanks in advance for any suggestions or insight. Please Cc:
> >jadams@ucar.edu if you can.
> >
> >
> >-James
Re: How to make a URL map to a servlet ?
Posted by Red <re...@draven.org>.
Hi
Well, you have to put the full path to the servlet in the servlet-class
tag.. like
<servlet-class>org.whatever.whoever.ServletClass</servlet-class>
Hope this helps
Red
>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<
Am 26.09.01, 10:21:45, schrieb James Adams <ja...@ucar.edu> zum Thema Re:
How to make a URL map to a servlet ?:
> Thanks for the quick response Lester.
> I thought web.xml might be the key. I have actually already added some
> entries to web.xml in order to try to get this to work but I guess I'm
not
> quite there yet. Here's what I have so far, perhaps somebody can tell me
what
> I'm doing wrong:
> -------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
> <web-app>
> <display-name>MOPITT Data Selection</display-name>
> <session-timeout>30</session-timeout>
> <servlet>
> <servlet-name>Servlet</servlet-name>
> <servlet-class>Servlet</servlet-class>
> </servlet>
> <servlet>
> <servlet-name>SelectValidator</servlet-name>
> <servlet-class>SelectValidator</servlet-class>
> </servlet>
> </web-app>
> -------------------------
> Thanks,
> James
> Lester June Cabrera wrote:
> > Hi James,
> >
> > Tomcat is bundled with a "build" utility. By editing /etc/web.xml in your
> > development directory, you should be able to map your servlet class to
your
> > desired URL.
> >
> > Lester
> >
> > At 01:58 AM 9/26/01 -0600, you wrote:
> > >I have a servlet which looks at the request, makes sure that there is a
> > >Session and the necessary beans included in the Session and then directs
> > >to a JSP page. I want to be able to enter a URL and get the servlet
> > >(which will direct me to the JSP).
> > >
> > >I have the JSP in $TOMCAT_HOME/webapps/myapp/Myapp.jsp and the servlet
> > >in $TOMCAT_HOME/webapps/myapp/WEB-INF/classes/Servlet.
> > >
> > >Can anyone tell me how I can set things up so that I can enter a URL and
> > >get the servlet to run ? I have tried using URL's such as
> > >http://myserver.my.domain:8080/myapp/Servlet and
> > >http://myserver.my.domain:8080/myapp/servlet/Servlet but these don't
> > >appear to work. I'm stumped.
> > >
> > >I'm running Tomcat version 3.2.1-1, the OS is Red Hat 7.0.
> > >
> > >Thanks in advance for any suggestions or insight. Please Cc:
> > >jadams@ucar.edu if you can.
> > >
> > >
> > >-James
Re: How to make a URL map to a servlet ?
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Wed, 26 Sep 2001, James Adams wrote:
> Date: Wed, 26 Sep 2001 02:21:45 -0600
> From: James Adams <ja...@ucar.edu>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org
> Subject: Re: How to make a URL map to a servlet ?
>
> Thanks for the quick response Lester.
>
> I thought web.xml might be the key. I have actually already added some
> entries to web.xml in order to try to get this to work but I guess I'm not
> quite there yet. Here's what I have so far, perhaps somebody can tell me what
> I'm doing wrong:
>
You would do well to start by reading the Servlet Specification, which
describes how web applications work and what all the settings are for. In
particular, you will find that <servlet-mapping> elements are required to
establish the actual mapping of URIs to <servlet> definitions.
http://java.sun.com/products/servlet/download.html
Craig McClanahan
> -------------------------
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
>
> <web-app>
> <display-name>MOPITT Data Selection</display-name>
> <session-timeout>30</session-timeout>
> <servlet>
> <servlet-name>Servlet</servlet-name>
> <servlet-class>Servlet</servlet-class>
> </servlet>
> <servlet>
> <servlet-name>SelectValidator</servlet-name>
> <servlet-class>SelectValidator</servlet-class>
> </servlet>
> </web-app>
>
> -------------------------
>
> Thanks,
> James
>
>
>
>
> Lester June Cabrera wrote:
>
> > Hi James,
> >
> > Tomcat is bundled with a "build" utility. By editing /etc/web.xml in your
> > development directory, you should be able to map your servlet class to your
> > desired URL.
> >
> > Lester
> >
> > At 01:58 AM 9/26/01 -0600, you wrote:
> > >I have a servlet which looks at the request, makes sure that there is a
> > >Session and the necessary beans included in the Session and then directs
> > >to a JSP page. I want to be able to enter a URL and get the servlet
> > >(which will direct me to the JSP).
> > >
> > >I have the JSP in $TOMCAT_HOME/webapps/myapp/Myapp.jsp and the servlet
> > >in $TOMCAT_HOME/webapps/myapp/WEB-INF/classes/Servlet.
> > >
> > >Can anyone tell me how I can set things up so that I can enter a URL and
> > >get the servlet to run ? I have tried using URL's such as
> > >http://myserver.my.domain:8080/myapp/Servlet and
> > >http://myserver.my.domain:8080/myapp/servlet/Servlet but these don't
> > >appear to work. I'm stumped.
> > >
> > >I'm running Tomcat version 3.2.1-1, the OS is Red Hat 7.0.
> > >
> > >Thanks in advance for any suggestions or insight. Please Cc:
> > >jadams@ucar.edu if you can.
> > >
> > >
> > >-James
>
>
Re: How to make a URL map to a servlet ?
Posted by James Adams <ja...@ucar.edu>.
Thanks for the quick response Lester.
I thought web.xml might be the key. I have actually already added some
entries to web.xml in order to try to get this to work but I guess I'm not
quite there yet. Here's what I have so far, perhaps somebody can tell me what
I'm doing wrong:
-------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
<display-name>MOPITT Data Selection</display-name>
<session-timeout>30</session-timeout>
<servlet>
<servlet-name>Servlet</servlet-name>
<servlet-class>Servlet</servlet-class>
</servlet>
<servlet>
<servlet-name>SelectValidator</servlet-name>
<servlet-class>SelectValidator</servlet-class>
</servlet>
</web-app>
-------------------------
Thanks,
James
Lester June Cabrera wrote:
> Hi James,
>
> Tomcat is bundled with a "build" utility. By editing /etc/web.xml in your
> development directory, you should be able to map your servlet class to your
> desired URL.
>
> Lester
>
> At 01:58 AM 9/26/01 -0600, you wrote:
> >I have a servlet which looks at the request, makes sure that there is a
> >Session and the necessary beans included in the Session and then directs
> >to a JSP page. I want to be able to enter a URL and get the servlet
> >(which will direct me to the JSP).
> >
> >I have the JSP in $TOMCAT_HOME/webapps/myapp/Myapp.jsp and the servlet
> >in $TOMCAT_HOME/webapps/myapp/WEB-INF/classes/Servlet.
> >
> >Can anyone tell me how I can set things up so that I can enter a URL and
> >get the servlet to run ? I have tried using URL's such as
> >http://myserver.my.domain:8080/myapp/Servlet and
> >http://myserver.my.domain:8080/myapp/servlet/Servlet but these don't
> >appear to work. I'm stumped.
> >
> >I'm running Tomcat version 3.2.1-1, the OS is Red Hat 7.0.
> >
> >Thanks in advance for any suggestions or insight. Please Cc:
> >jadams@ucar.edu if you can.
> >
> >
> >-James
Re: How to make a URL map to a servlet ?
Posted by Lester June Cabrera <le...@vinciworks.com>.
Hi James,
Tomcat is bundled with a "build" utility. By editing /etc/web.xml in your
development directory, you should be able to map your servlet class to your
desired URL.
Lester
At 01:58 AM 9/26/01 -0600, you wrote:
>I have a servlet which looks at the request, makes sure that there is a
>Session and the necessary beans included in the Session and then directs
>to a JSP page. I want to be able to enter a URL and get the servlet
>(which will direct me to the JSP).
>
>I have the JSP in $TOMCAT_HOME/webapps/myapp/Myapp.jsp and the servlet
>in $TOMCAT_HOME/webapps/myapp/WEB-INF/classes/Servlet.
>
>Can anyone tell me how I can set things up so that I can enter a URL and
>get the servlet to run ? I have tried using URL's such as
>http://myserver.my.domain:8080/myapp/Servlet and
>http://myserver.my.domain:8080/myapp/servlet/Servlet but these don't
>appear to work. I'm stumped.
>
>I'm running Tomcat version 3.2.1-1, the OS is Red Hat 7.0.
>
>Thanks in advance for any suggestions or insight. Please Cc:
>jadams@ucar.edu if you can.
>
>
>-James