This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Request Dispatcher  RSS feed

 
Tarun Oohri
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 5564
711
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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")
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!