This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes Not displaying images when using RequestDispatcher.forward() for passing control from Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Not displaying images when using RequestDispatcher.forward() for passing control from" Watch "Not displaying images when using RequestDispatcher.forward() for passing control from" New topic
Author

Not displaying images when using RequestDispatcher.forward() for passing control from

kishukishor patil
Greenhorn

Joined: Nov 20, 2008
Posts: 23

Hello all...

Here i'm trying to pass control from servlet to jsp using RequestDispatcher.forward(). When i'm trying with sendRedirect it works fine ....but for forward() it doesn't shows images and also not applies the css
.. can anyone help me....?


Thanks......
kishukishor patil
Greenhorn

Joined: Nov 20, 2008
Posts: 23

code that i implemented is.....

RequestDispatcher dispatch = getServletContext().getRequestDispatcher("/Project/login.jsp");
dispatch.forward(xmlreq, res);


xmlreq is request object and res is response object... it shows login.jsp but without images.....


please suggest if anyone encountered such problem.....
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Your URLs are most likely not relative to the root of the web application.
See:
http://faq.javaranch.com/java/RelativeLinks
and/or
http://faq.javaranch.com/java/ResourceUrlProblems


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
wood burning stoves
 
subject: Not displaying images when using RequestDispatcher.forward() for passing control from