By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,367 Members | 1,281 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,367 IT Pros & Developers. It's quick & easy.

Unable to do Request Dispatching among three servlets

P: 36
i have developed three servlets whose registered names are Demo,Next & Last
respectively.

//code for dispatching to Next in Demo
RequestDispatcher rd=getRequestDispatcher("Next");
rd.forward(req,res);
//code for dispatching to Last in Next
RequestDispatcher rd1=getRequestDispatcher("Last");
rd.forward(req,res);

problem
------------
the page is getting forwarded directly to Last without giving any output of
Next

Whats da mistake ?
Aug 13 '07 #1
Share this Question
Share on Google+
1 Reply


madhoriya22
100+
P: 252
i have developed three servlets whose registered names are Demo,Next & Last
respectively.

//code for dispatching to Next in Demo
RequestDispatcher rd=getRequestDispatcher("Next");
rd.forward(req,res);
//code for dispatching to Last in Next
RequestDispatcher rd1=getRequestDispatcher("Last");
rd.forward(req,res);

problem
------------
the page is getting forwarded directly to Last without giving any output of
Next

Whats da mistake ?
Hi,
U should call getRequestDispatcher("Next") like this:-
Expand|Select|Wrap|Line Numbers
  1.  
  2. RequestDispatcher rd = request.getRequestDispatcher("Next");//where request is instance of HttpServletRequest
  3.  
and always wrap ur code in code tags. Luk how nice it is luking here :)

Thanks and regards,
madhoriya22
Aug 13 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.