It's not a secret anymore!*
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 Android Security Essentials Live Lessons this week in the Android 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Not displaying images when using RequestDispatcher.forward() for passing control from
 
Similar Threads
jsp:forward question...
RequestDispatcher forward doubt?
Regarding forwarding and including response from other Servlets
forwarding within the application
difference between sendRedirect and forward of Requestdispatcher