This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to call jsp page from servlet

 
Rupa Katkar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to call jsp page in my servlet
How should i call that.

Please give me reply.. urgently
 
Anuj Prashar
Ranch Hand
Posts: 99
Android Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use this ..

RequestDispatcher req=request.getRequestDispatcher("/path of your jsp");
req.forward(request, response);
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Call it from your service[doGet or doPost]


instead of request ,you can use ServletContext to get requestdispatcher.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
uha.. Anuj beat me here
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rupa,

Your question is little bit tricky... but any way use



 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nishan Patel wrote:
Your question is little bit tricky...


Hi Nishan , How this question is tricky ? can you explain ?
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to call jsp page


here you are dispatch your request to your Jsp page.... So, form servlet you pass request to your Jsp page...

so question look likes how to dispatch or pass request form servlet to jsp...
 
Anuj Prashar
Ranch Hand
Posts: 99
Android Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@seetharaman venkatasamy

lol
 
Rupa Katkar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nishan Patel wrote:Hi Rupa,

Your question is little bit tricky... but any way use








Thank you to all
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nishan Patel wrote:So, form servlet you pass request to your Jsp page...


fine. any way after dispatch to the jsp,again the execution flow back to the servlet .
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fine. any way after dispatch to the jsp,again the execution flow back to the servlet .


yes...but not same servlet it's depending on requirement .... flow looks like Jsp -> Servlet -> Jsp
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nishan Patel wrote: .... flow looks like Jsp -> Servlet -> Jsp


i am mentioned about



sorry , if i didnt mentioned clearly
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic