• Post Reply Bookmark Topic Watch Topic
  • New Topic

Include Servlet Problem  RSS feed

 
Katarina Fors
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all!
I have a problem I cannot solve, I will try to explain.

I have a jsp page, at the bottom I include a servlet : <jsp:include page="Test.do" />

The servlet simply does a : out.println("<h1>TEST!</h1>");

So far everything works fine.

At this jsp page you can type in username and password in a form, and submit.

If username and password are correct, you get directed to another jsp page, which also has the <jsp:include page="Test.do" /> at the bottom of it.

However, when logged in correctly and being sent to this page, the include does not work.

If I however type the url to this page by myself in the url bar, and skip to actual log in via servlet, the include works.

If you at the login page type the wrong username and password, you just get directed back to the same login page.

If you do this the include does not work either. It does work when you first go to the page however, or if you type in the url manually.

I have tested more, and it seems everytime I go via a doPost and get directed to one of my pages, the <jsp:include page="Test.do" /> does not work at all.

Anyone know why? I am going crazy.

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66156
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Test.do" is not a properly formed, context-relative URL. Your URLs should always start with /.
 
Katarina Fors
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same result with both <jsp:include page="Test.do" /> and <jsp:include page="/Test.do" />.

As I said, it works when I load the page the first time, or manually, but not after
getting directed back via doPost in a servlet.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66156
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What URL works to display the servlet directly?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!