This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Request Dispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Request Dispatcher" Watch "Request Dispatcher" New topic

Request Dispatcher

Tarun Oohri
Ranch Hand

Joined: Feb 20, 2013
Posts: 172
Hi Everyone
Is it true that , we can not use dispatcher to navigate from a servlet to a Jsp ?

It doesnt work for me, But if i use Redirect then it does work ... why is that ? Thanks!!!
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3013

No it's NOT true - you can dispatch from a servlet to JSP, and that's what you should do following MVC. The problem with your code could be the template Next.jsp being not found in the context. Since it is very unlikely that you need to allow your users directly access Next.jsp, put it somewhere in WEB-INF directory, say, for example, as in WEB-INF/templates/next.jsp . When you forward, use the context-relative path, as in getRequestDispatcher("/WEB-INF/templates/next.jsp")

Founder of ExamLab and Systemup
See how I can help you to become an awesome programmer
I agree. Here's the link:
subject: Request Dispatcher
Similar Threads
directing page
Webservices Client
Issue with Struts 2 Dispatcher Result
Sitemesh doesnt decorate any pages after action class is called
How to call strtus2 action from struts1 action in integrated project?