Introduction to Java Server Pages
 
JSP Advantages
 
1. Separation of static from dynamic content
With servlets, the logic for creation of the dynamic content is an intrinsic part of the servlet and is closely tied to the static appearance templates responsible for the user interface. Thus, even minor changes made to the UI typically result in the recompilation of the servlet. This tight coupling of presentation and content results in brittle, inflexible applications. However, with JSP, the logic to generate the dynamic content is kept separate from the static presentation templates by encapsulating it within external JavaBeans components. These are then created and used by the JSP page using special tags and scriptlets. When a page designer makes any changes to the presentation template, the JSP page is automatically recompiled and reloaded into the web server by the JSP engine
 
2. Write Once Run Anywhere
JSP technology brings the "Write Once, Run Anywhere" paradigm to interactive Web pages. JSP pages can be moved easily across platforms, and across web servers, without any changes
 
3. Dynamic content can be served in a range of formats:
There is nothing that mandates the static template data within a JSP page to be of a certain format. Therefore, JSP can service a diverse clientele ranging from conventional browsers using HTML/DHTML, to handheld wireless devices like mobile phones and PDAs using WML, to other B2B applications using XML
 
4. Recommended Web access layer for n-tier architecture:
Sun's J2EE Blueprints, which offers guidelines for developing large-scale applications using the enterprise Java APIs, categorically recommends JSP over servlets for serving dynamic content.
 
5. Completely leverages the Servlet API:
If we are a servlet developer, there is very little that we have to "unlearn" to move over to JSP. In fact, servlet developers are at a distinct advantage because JSP is nothing but a high-level abstraction of servlets. We can do almost anything that can be done with servlets using JSP--but more easily