Integrating Servlets and JSP: The Model View Controller - Java ...
Integrating Servlets and JSP: The Model View Controller - Java ...
Integrating Servlets and JSP: The Model View Controller - Java ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Summary44• Request scope– A new bean instance is made on every HTTP request.– <strong>The</strong> most common scope.• Session scope– A bean instance could be reused if the request is from thesame user in the same browser session. Useful fortracking user-specific data.• See session tracking lecture for details• Remember to make bean Serializable• Application (ServletContext) scope– Once created, the same bean instance is used for allrequests <strong>and</strong> all users.• Must synchronize. Very rare.Comparing Data-SharingApproaches: Request• Goal– Display a r<strong>and</strong>om number to the user• Type of sharing– Each request should result in a new number, so requestbasedsharing is appropriate.45