• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet now always forwarding to same page

 
Tom Joiner
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created the following servlet:



The problem is it always goes to "Overview.html" and never goes to Test.html. I have tried recompiling the servlet, rerunning it, and it still always goes to the place I directed it on the first compile.

Why?


Another related question.. where do people normally stick their jsp pages for handling web pages? I have been sticking them in

\project\build\web\folder\name.jsp

But now it looks like perhaps I should be placing them in

\project\WEB-INF\folder\name.jsp

which is correct?
[ November 15, 2006: Message edited by: Tom Joiner ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code tags are malformed.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tom Joiner:
The problem is it always goes to "Overview.html" and never goes to Test.html. I have tried recompiling the servlet, rerunning it, and it still always goes to the place I directed it on the first compile.


Have you restarted the web app?

nother related question.. where do people normally stick their jsp pages for handling web pages? I have been sticking them in

\project\build\web\folder\name.jsp

But now it looks like perhaps I should be placing them in

\project\WEB-INF\folder\name.jsp

which is correct?[/QB]


Either can be correct. If your JSPs are to be directly addressable they must reside outside of the WEB-INF folder. If they are not to be addressable, and only reachable through their servlet controllers, then placing them under WEB-INF is appropriate.
 
Tom Joiner
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure actually how to "restart the web app". I closed the browser, and then reran the application in the NetBeans IDE using "Run Main Project".

I managed to fix the problem by renaming the original servlet. Then, I added in a new link in the web.xml so that the web server could see this new servlet, and the new servlet is working properly. I am not sure what was going wrong but thanks for the ideas.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Renaming the servlet to fix this is not a good solution. When a servlet is changed, the web app needs to be restarted. You should learn how to run a web app outside of an IDE. Otherwise, you are hobbled.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic