• Post Reply Bookmark Topic Watch Topic
  • New Topic

Request Dispatcher not working

 
ragi singh
Ranch Hand
Posts: 198
Oracle Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet which retrieves a brand name from a model class and displays the result using PrintWriter . However , when i am using RequestDispatcher to redirect it to JSP it is not working , i mean the JSP page is getting displayed . Can anyone help me with it .
My code for the servlet is as follows:-



 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to use code tags when posting code to the forums. Unformatted or unindented code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please click this link ⇒ UseCodeTags ⇐ for more information.

Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, relative path will be the problem. Where is your result.jsp situated?
 
ragi singh
Ranch Hand
Posts: 198
Oracle Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my application is in BeerApp folder

and the result.jsp is in the web folder in WEB-INF . I have given the path "/result.jsp" as an argument to getRequestDispatcher() .
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the file is in WEB-INF, why isn't that part of the URL?
 
Virendrasinh Gohil
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:If the file is in WEB-INF, why isn't that part of the URL?

That's true ragi singh. You have to either keep the result.jsp outside of WEB-INF or keep WEB-INF in path.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!