RequestDispatcher is an interface which has two important abstract methods defined.
1. include()
2. forward()
Both the methods are used to delegates the control
from one Servlet to another Servlet / JSP or
from one JSP to another JSP/Servlet .
How to create object of RequestDispatcher ?
This can be achieved in two ways:-
1. With HttpServletRequest object : It can be created by calling getRequestDispatcher(String resourceName) method by HttpServletRequest object.
1. include()
2. forward()
Both the methods are used to delegates the control
from one Servlet to another Servlet / JSP or
from one JSP to another JSP/Servlet .
How to create object of RequestDispatcher ?
This can be achieved in two ways:-
1. With HttpServletRequest object : It can be created by calling getRequestDispatcher(String resourceName) method by HttpServletRequest object.
public void service(HttpServletRequest req,HttpServletReponse res){
......
RequestDispatcher rd= req.getRequestDispatcher("xxx.jsp");
}
To know more about this click here..!!
2. With ServletContext object : It can be created by calling getRequestDispatcher(String resourceName) method by ServletContext object.
public void service(HttpServletRequest req,HttpServletReponse res){
......
ServletContext ctx= this.getServletContext();
RequestDispatcher rd= ctx.getRequestDispatcher("xxx.jsp");
}
The above two ways will create the object of RequestDispatcher. To dispatch the control we need to call either include(req,res) or forward(req,res) with RequestDispatcher object.
Note : To know the difference between getting RequestDsipatcher object with HttpServleRequest and ServletContext , Click Here..!!
Signature of forward(req,res)
public void forward(ServletRequest req,ServletReponse res)
throws ServletException, IOException {
}
Forward() method has two parameter of ServletResquest and ServletResponse but we are storing HttpServletRequest and HttpServletResponse object as a parameter.
It is possible because internally HttpServletRequest extends ServletRequest which means we can able to wrap HttpServletRequest object to ServletRqeuest reference. This is same with HttpServletResponse and ServletResponse.
public abstract interface HttpServletRequest extends ServletRequest {
}
Signature of include(req,res)
public void include(ServletRequest req,ServletReponse res)
throws ServletException, IOException {
}
Include() has same signature as forward() method has. Difference is with the operation.
Note : To know the difference between using include() and forward(), Click Here..!!
Note : To know the difference between using include() and forward(), Click Here..!!
There are only two methods of RequestDispatcher interface, that is forward()
ReplyDeleteand include()
Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
ReplyDeleteOracle Training In Chennai
very nice and informative blog
ReplyDeletejava training in chennai
dot net training in chennai
Useful Article! Thank you Admin!
ReplyDeleteIT project centers in chennai | Engineering project centers in chennai
Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
ReplyDeleteMEAN stack training in Chennai
MEAN stack training in bangalore
MEAN stack training in tambaram
MEAN stack training in annanagar
MEAN stack training in Velachery
MEAN stack training Sholinganallur
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeleteDevops Training in Chennai
Devops Training in Bangalore
I really like your blog. You make it interesting to read and entertaining at the same time. I cant wait to read more from you.
ReplyDeletepython training in chennai
python training in chennai
python training in Bangalore
This looks absolutely perfect. All these tiny details are made with lot of background knowledge. I like it a lot.
ReplyDeletejava online training | java training in pune
java training in chennai | java training in bangalore
Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.
ReplyDeleteData Science course in rajaji nagar | Data Science with Python course in chenni
Data Science course in electronic city | Data Science course in USA
Data science course in pune | Data science course in kalyan nagar
I liked your blog.Thanks for your interest in sharing the information.keep updating.
ReplyDeleteSelenium Training in Chennai
Selenium Training
iOS Training in Chennai
iOS Training Institutes in Chennai
Salesforce Training in Chennai
Salesforce Training
All the points you described so beautiful. Every time i read your i blog and i am so surprised that how you can write so well.
ReplyDeleteangularjs Training in chennai
angularjs Training in chennai
angularjs-Training in tambaram
angularjs-Training in sholinganallur
angularjs-Training in velachery
This information is impressive. I am inspired with your post writing style & how continuously you describe this topic. Eagerly waiting for your new blog keep doing more.
ReplyDeleteFranchise Business in India
Education Franchise
Computer Education Franchise
Education Franchise India
Computer Center Franchise
Education Franchise Opportunities in India
Education Franchise Opportunities in India
Spoken English Franchise
Franchise in Education Sector
Franchise For Spoken English Classes
I am happy to find this post Very useful for me, as it contains lot of information
ReplyDeleteGuest posting sites
Education
Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.
ReplyDeleteHadoop Training in Chennai
Cloud computing Training
Best institute for Cloud computing in Chennai
Cloud computing Training Chennai
Big Data Course in Chennai
Big Data Hadoop Training in Chennai
Nice Article,Great experience for me by reading this info.
ReplyDeletethanks for sharing the information with us.keep updating your ideas.
Selenium Training in Nungambakkam
Selenium Training Institutes in Vadapalani
Selenium Training courses near me
Selenium Training in Chennai
Nice idea,keep sharing your ideas with us.i hope this information's will be helpful for the new learners.
ReplyDeletevmware Training in Ashok Nagar
vmware Training in Nungambakkam
vmware Training in Vadapalani
I have to thank for sharing this blog, it is really helpful and I learned a lot from your blog.
ReplyDeleteData Science Training in Vadapalani
Data Science Training in Chennai
Data Science Course in Chennai
Data Science Training in Saidapet
Data Science Classes near me
Data Science Training in Aminjikarai
Thanks for sharing a worthy information. This is really helpful for learning. Keep doing more.
ReplyDeleteIELTS Classes in Camp Road
IELTS Training Institute in ECR
IELTS Training in Kasturibai Nagar
IELTS Coaching Classes near me
IELTS Classes near Adyar
IELTS Classes in Gandhi Nagar
IELTS Classes in Indira Nagar
Wonderful article, very useful and well explanation. Your post is extremely incredible. I will refer this to my candidates...
ReplyDeleteJava training in Bangalore | Java training in Marathahalli | Java training in Bangalore | Java training in Btm layout
Java training in Bangalore | Java training in Jaya nagar | Java training in Bangalore | Java training in Electronic city
Your story is truly inspirational and I have learned a lot from your blog. Much appreciated.
ReplyDeletepython training in chennai | python course institute in chennai | Data Science Interview questions and answers
Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging
ReplyDeleteData Science training in rajaji nagar | Data Science Training in Bangalore | Data Science with Python training in chennai
Data Science training in electronic city | Data Science training in USA
Data science training in pune | Data science training in kalyan nagar
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeleteangularjs Training in bangalore
angularjs Training in bangalore
angularjs Training in chennai
automation anywhere online Training
angularjs interview questions and answers
I’d love to be a part of group where I can get advice from other experienced people that share the same interest. If you have any recommendations, please let me know. Thank you.
ReplyDeletehealth and safrety courses in chennai
Really an interesting blog, continue sharing more like this.
ReplyDeleteBlue Prism Training in Chennai
Blue Prism Training
Blue Prism Training near me
Blue Prism Training Chennai
Blue Prism Training Institute in Chennai
Nice Blog. Extra-ordinary piece of work. You are an amazing writer. Thanks for sharing.
ReplyDeleteDrupal Training in Chennai
Drupal Course in Chennai
Drupal Certification Training
Drupal 8 Training
Drupal 7 Training
Html5 Training in Chennai
Html5 Courses in Chennai
Nice blog thanks for sharing
ReplyDeletesoftware testing training institute in chennai
Thanks for sharing this information admin, it helps me to learn new things. Continue sharing more like this.
ReplyDeleteDevops Training in Chennai | Devops Training Institute in Chennai
Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
ReplyDeleteAppium training in Coimbatore
Appium Course in coimbatore
Appium coaching in Coimbatore
AWS training in Coimbatore
RPA Training in Coimbatore
Data Analytics Courses in Coimbatore
Python Course in Coimbatore
Big Data Course in Coimbatore
Thanks for posting this highly informative article. I feel glad about learning more about this concept. Maintain the number of posting and keep up the good work!
ReplyDeleteData Science Course in Chennai | Data Science Training in Chennai
Great blog thanks for sharing Finally, an SEO agency in Chennai that understands exactly what you need. Adhuntt Media knows advanced search engine optimization and branding like the back of their hand. Let’s kickstart your brand right here right now!
ReplyDeletedigital marketing company in chennai
seo service in chennai
web designing company in chennai
social media marketing company in chennai
Nice blog thanks for sharing Join the Karuna Nursery Garden family and be a part of our network of home gardeners. We can help you setup the perfect front yard for your family to relax in. Reach us out to get more information on our terrace garden consultants in Chennai too.
ReplyDeleteplant nursery in chennai
rental plants in chennai
corporate gardening service in chennai
such a great word which you use in your article and article is amazing knowledge. thank you for sharing it.
ReplyDeleteLearn Best Microstrategy Training in Bangalore from Experts. Softgen Infotech offers the Best RPA Training in Bangalore.100% Placement Assistance, Live Classroom Sessions, Only Technical Profiles, 24x7 Lab Infrastructure Support.
This comment has been removed by the author.
ReplyDeleteThe same out of date rehashed material. Fantastic read.
ReplyDeleteAWS training in chennai | AWS training in anna nagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery