Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not including the template when usin RequestDispatcher

 
Priyam Srivastava
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a part of my Servlet code:

where company is an object of class Company.

though the browser is dispalying the registrationComplete.jsp page but the problem is that jsp uses a template "home.dwt" and it doesnot include the template (or the images) when the control is transferred from servlet to jsp page using RequestDispatcher...
but it displays the template contents correctly if I transfer the control from servlet to jsp page using sendRedirect() i.e

on my registrationComplete.jsp page i am using the following jsp code:


with sendRedirect() I would be getting a null value...

Can anyone tell why the template element is not displayed in the jsp while using RequestDispatcher()?

I also tried using:


PS: The attribute value is being displayed correctly when using RequestDispatcher.
[ February 23, 2008: Message edited by: Priyam Srivastava ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your links are probably off when doing a server side forward.
The way to prevent this is to make all of your URLS (image src, form action, css href)s relative to the context instead of being relative to the page.
See:
http://faq.javaranch.com/java/ResourceUrlProblems
for a complete explanation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic