• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Include Servlet Problem

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What URL works to display the servlet directly?
 
reply
    Bookmark Topic Watch Topic
  • New Topic