Seminar Topics & Project Ideas On Computer Science Electronics Electrical Mechanical Engineering Civil MBA Medicine Nursing Science Physics Mathematics Chemistry ppt pdf doc presentation downloads and Abstract

Full Version: Integrating Servlets JSP: The MVC Architecture ppt
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Integrating Servlets and JSP: The MVC Architecture

[attachment=32924]

Uses of JSP Constructs

Scripting elements calling servlet code directly
Scripting elements calling servlet code indirectly (by means of utility classes)
Beans
Custom tags
Servlet/JSP combo (MVC), with beans and possibly custom tags

Why Combine Servlets & JSP?

Typical picture: use JSP to make it easier to develop and maintain the HTML content
For simple dynamic code, call servlet code from scripting elements
For slightly more complex applications, use custom classes called from scripting elements
For moderately complex applications, use beans and custom tags
But, that's not enough
For complex processing, starting with JSP is awkward
Despite the ease of separating the real code into separate classes, beans, and custom tags, the assumption behind JSP is that a single page gives a single basic look

Possibilities for Handling a Single Request

Servlet only
Output is a binary type. E.g.: an image
No output. E.g.: you are doing forwarding or redirection as in Search Engine example.
Format/layout of page is highly variable. E.g.: portal.
JSP only
Output is mostly character data. E.g.: HTML
Format/layout mostly fixed.
Combination
A single request will result in multiple substantially different-looking results.
Complicated data processing, but relatively fixed layout.
These apply to a single request
You still use both servlets and JSP within your overall application.