You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alan Shiers <as...@hfx.eastlink.ca> on 2002/08/03 21:21:53 UTC

newbie trying to run tomcat 4

Hi there,

I've downloaded Tomcat 4 for the first time and have been pouring over
these documents at the jakarta site trying to make sense of it all.  I
was able to set a context for a new webapp in server.xml and I'm able to
navigate with Netscape to the web app with
http://localhost:8080/mytest/index.html

That part works just fine.  I have a simple servlet sitting in my
WEB-INF directory and my index.html file has a link in it that is
supposed to launch the servlet:
http://localhost:8080/mytest/servlet/sqlnames

However, every time I try to click on the link, Netscape opens its
SaveAs dialog box. For some stupid reason it seems to think I'm trying
to save a file.  Has anyone had that happen before?  How do I make
Netscape understand that I'm not trying to save a file.  I just want to
launch the servlet!  What am I doing wrong?

Alan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: newbie trying to run tomcat 4

Posted by Markus Bengts <ma...@click3.jsp.fi>.
On Sat, 3 Aug 2002, Alan Shiers wrote:

> Does a servlet name always have to start with an uppercase letter?

A java class name usually starts with uppercase. I don't know if it has
to. Try if you're intrested. You can use different url-patterns.

>
> The reason I wrote the URL like this:
> http://localhost:8080/mytest/servlet/sqlnames
>
> is only because of how I wrote the web.xml file which looks like this:
>
> <?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>
>
> 		sqlnames
>
> 	  </servlet-name>
>
>         <servlet-class>
>
>             MySQLNamesTest
>
>         </servlet-class>
>    </servlet>

<!-- I think all servlet-tags must come first and then servlet-mapping. -->


     <servlet-mapping>
 	  <servlet-name>
 		sqlnames
 	  </servlet-name>
          <url-pattern>
                /sqlnames
          </url-pattern>
     </servlet-mapping>

> </web-app>
>
> Maybe I need to change this somehow?
>
> Please advise,
>
> Alan
>
> Markus Bengts wrote:
> >
> > On Sat, 3 Aug 2002, Alan Shiers wrote:
> >
> > > was able to set a context for a new webapp in server.xml and I'm able to
> > > navigate with Netscape to the web app with
> > > http://localhost:8080/mytest/index.html
> > >
> > > That part works just fine.  I have a simple servlet sitting in my
> > > WEB-INF directory and my index.html file has a link in it that is
> > > supposed to launch the servlet:
> > > http://localhost:8080/mytest/servlet/sqlnames
> >
> > If the file Sqlnames.class is in WEB-INF/classes, then the url should be:
> > http://localhost:8080/mytest/servlet/Sqlnames
> >                                      ^
> >
> > > However, every time I try to click on the link, Netscape opens its
> > > SaveAs dialog box.
> >
> > Does the servlet return text/html? Like this:
> >
> > response.setContentType("text/html");
> >

       Markus


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: newbie trying to run tomcat 4

Posted by Alan Shiers <as...@hfx.eastlink.ca>.
Hi Markus,

Does a servlet name always have to start with an uppercase letter?

The reason I wrote the URL like this:
http://localhost:8080/mytest/servlet/sqlnames

is only because of how I wrote the web.xml file which looks like this:

<?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>

		sqlnames

	  </servlet-name>

        <servlet-class>

            MySQLNamesTest

        </servlet-class>
   </servlet>
</web-app>

Maybe I need to change this somehow?

Please advise,

Alan

Markus Bengts wrote:
> 
> On Sat, 3 Aug 2002, Alan Shiers wrote:
> 
> > was able to set a context for a new webapp in server.xml and I'm able to
> > navigate with Netscape to the web app with
> > http://localhost:8080/mytest/index.html
> >
> > That part works just fine.  I have a simple servlet sitting in my
> > WEB-INF directory and my index.html file has a link in it that is
> > supposed to launch the servlet:
> > http://localhost:8080/mytest/servlet/sqlnames
> 
> If the file Sqlnames.class is in WEB-INF/classes, then the url should be:
> http://localhost:8080/mytest/servlet/Sqlnames
>                                      ^
> 
> > However, every time I try to click on the link, Netscape opens its
> > SaveAs dialog box.
> 
> Does the servlet return text/html? Like this:
> 
> response.setContentType("text/html");
> 
>       Markus
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: newbie trying to run tomcat 4

Posted by Markus Bengts <ma...@click3.jsp.fi>.
On Sat, 3 Aug 2002, Alan Shiers wrote:

> was able to set a context for a new webapp in server.xml and I'm able to
> navigate with Netscape to the web app with
> http://localhost:8080/mytest/index.html
>
> That part works just fine.  I have a simple servlet sitting in my
> WEB-INF directory and my index.html file has a link in it that is
> supposed to launch the servlet:
> http://localhost:8080/mytest/servlet/sqlnames

If the file Sqlnames.class is in WEB-INF/classes, then the url should be:
http://localhost:8080/mytest/servlet/Sqlnames
                                     ^

> However, every time I try to click on the link, Netscape opens its
> SaveAs dialog box.

Does the servlet return text/html? Like this:

response.setContentType("text/html");


      Markus




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>