Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Java Servlet on Sun server
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.


Report this thread to moderator Post Follow-up to this message
Old Post
WERNOTKIN
10-19-04 09:02 AM


Re: Java Servlet on Sun server
> 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...




Report this thread to moderator Post Follow-up to this message
Old Post
KC Wong
10-19-04 09:02 AM


Re: Java Servlet on Sun server
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/

Report this thread to moderator Post Follow-up to this message
Old Post
William Brogden
10-19-04 02:06 PM


Re: Java Servlet on Sun server
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.


Report this thread to moderator Post Follow-up to this message
Old Post
WERNOTKIN
10-20-04 01:57 AM


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


Report this thread to moderator Post Follow-up to this message
Old Post
WERNOTKIN
10-20-04 01:57 AM


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


Report this thread to moderator Post Follow-up to this message
Old Post
WERNOTKIN
10-20-04 01:57 AM


Re: Java Servlet on Sun server
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.


Report this thread to moderator Post Follow-up to this message
Old Post
WERNOTKIN
10-27-04 08:59 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:54 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.