Were you redirected, or did you see "Hello World"?
When I do it, I get this (in the console):
And I see "Hello World" on my browser (no redirect).
Change yours to say "Hello World 2" and make sure you're running the right version, then check the console.
posted 14 years ago
Thanks for the effort of actually doing the program and suggesting a solution. I still do not get an 'IllegalStateException'. I do get 'Hello World'(or 'Hello World 2) on the browser and my console is absolutely neat and clean with no exceptions. I normally get an 'IllegalStateException' on the browser(for eg. the session management egs. on pg.247 of HFS book) and here I get none. But it is nice to know the program actually works the way it is supposed to! Thanks again, Jayanthi.
Hi Jayanthi, Which web server are u using, also what is the version of Servlet API you are using. Under normal circumstances you should get an Error. Also make sure that the .class file of your servlet contains res.sendRedirect("http://www.cnn.com"); may be you added this line later, and server still contains the older version.
Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"