For Programmers: Free Programming Magazines  


Home > Archive > Java Help > October 2004 > Java Servlet on Sun server









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Java Servlet on Sun server
WERNOTKIN

2004-10-19, 4:02 am

In my servlet code I call response.sendRedirct("www.google.com");

First I compile the source file with javac -classfile
"j2ee-directory/j2ee.jar"

Add the class file into the newly created .war file with deyploy tool
and specify the one and only class file as the servlet class.

Then I deploy the .war file using the admin console.

However once I go to the directory that should be mapped to the servlet
it does not redirect to www.google.com instead it shows a empty
directory listing.

I tryed placing the redirect in both service methods, and the doGet
method. However it never works correctly.

I know the servlet is deployed correctly because it does not return a
404 error or any other http/1.1 error code.

KC Wong

2004-10-19, 4:02 am

> In my servlet code I call response.sendRedirct("www.google.com");
>
> Add the class file into the newly created .war file with deyploy tool
> and specify the one and only class file as the servlet class.
> Then I deploy the .war file using the admin console.
>
> However once I go to the directory that should be mapped to the servlet
> it does not redirect to www.google.com instead it shows a empty
> directory listing.


Have you defined the welcome page of your web application? And turn off the
directory listing while you're at it...



William Brogden

2004-10-19, 9:06 am

On 18 Oct 2004 22:04:21 -0700, WERNOTKIN <wernotkin-google@yahoo.com>
wrote:

> In my servlet code I call response.sendRedirct("www.google.com");


Try a full URL ie "http://www.google.com/"
www.google.com is just a host, not a URL

>
> First I compile the source file with javac -classfile
> "j2ee-directory/j2ee.jar"
>
> Add the class file into the newly created .war file with deyploy tool
> and specify the one and only class file as the servlet class.
>
> Then I deploy the .war file using the admin console.
>
> However once I go to the directory that should be mapped to the servlet
> it does not redirect to www.google.com instead it shows a empty
> directory listing.


You "go to the directory" using what?

>
> I tryed placing the redirect in both service methods, and the doGet
> method. However it never works correctly.
>
> I know the servlet is deployed correctly because it does not return a
> 404 error or any other http/1.1 error code.
>


Bill

--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
WERNOTKIN

2004-10-19, 8:57 pm

I tryied using relative urls and full urls, on and off the server.
Well maybe not relative urls off the server ;-)
All give the same results.

WERNOTKIN

2004-10-19, 8:57 pm

I used both relative and full urls, on and off the server. Well, maybe
not relative urls off the server :-)

WERNOTKIN

2004-10-19, 8:57 pm

I used both relative and full urls, on and off the server. Well, maybe
not relative urls off the server :-)

WERNOTKIN

2004-10-27, 3:59 pm

I figured it out. I assumed that deploytool was setting the servlet
class as the servlet that is called within the context root. However I
had to manually add the servlet mapping code. It is fairly easy once
you know what your doing. Thanks anyways.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com