• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Request Dispatcher

 
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
ExamLab Creator
Marshal
Pie
Posts: 4414
252
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