* Request dispatcher is used to dispatch a request from one servlet to another servlet for futher proccessing.
- There are two importaint methods of Request dispatcher.those are:
+ forward();this method is used to forward one servlet to another servlet on the same server.
+ include():this method is used to include the content of another servlet,jsp and html pages.
* Example of Request dispatcher.
- We have techsupport.html file .This file is used to take request of user and send to techsupportservlet.After,techsupportservlet process and check whether user have registered or not.
if user have registered ,then user would be forwarded to ResponseServlet.If not user would be forwarded to RegisterServlet and when user have registered , this user is also forward to responseservlet.
* The following is code of the above example.
- This is index page.This page is used to help user entering information of them and after that this inforamtion is sent to Techsupporservlet.
- This is register page.This page is used to help user registering a new account.
- This is techsupportServlet.This page is used to recieve the information.That is send by user in index pages.After that ,This servlet check whether user have registered or not and forward to appropriate page.
This pages is used to respond result that user repuested.





No comments:
Post a Comment