Sun Java Solaris Communities My SDN Account Join SDN
 
White Paper

JavaServer Pages[tm] Technology - JavaServer Pages Servlet Developer White Paper

 

JavaServer PagesTM Technology for Servlet Developers

Introduction

If you're already using JavaTM Servlets, you may wonder what advantages JavaServer PagesTM (JSP) technology has for you. You can already develop interactive Web pages with servlets alone. So is JSP technology just an easier way for people who don't write servlets to get this functionality?

Although JSP pages can jumpstart servlet development, that's only part of the story. Even if you're comfortable writing servlets, there are several compelling reasons to investigate JSP technology as a complement to your existing work.

Built on Servlets

JSP technology is an extension of the servlet technology created to support authoring of HTML and XML pages. It makes it easier to combine fixed or static template data with dynamic content. With JSP technology, pages are actually compiled dynamically into servlets, so they have all of the benefits of servlets as well as access to Java APIs.

Easier to Use for Interactive Pages

Although you can certainly create dynamic, interactive pages with servlets alone, using JSP technology makes the process even easier.

  • With JSP pages, it is easy to combine static templates, including HTML or XML fragments, with the code to generate dynamic content.
  • JSP pages compile dynamically into servlets when requested. JSP pages can also be precompiled into servlets.
  • The JSP page structure makes it easier to author pages "by hand".
  • The JSP tags for invoking JavaBeansTM components manage these components completely, shielding the page author from complexity.
  • The JSP page structure also supports authoring tools, which are now becoming more and more available.

Most importantly, JSP technology provides developers with an easy way to distribute application functionality to a wide range of page authors. These authors do not have to know the Java language or even be able to write servlets.

Concentrate on Development Instead of Page Authoring

There's more to the JSP technology than a "Servlets for Dummies" approach. Because it makes page authoring easier and supports component-based development, developers can focus on creating application functionality instead of designing and maintaining individual pages.

By separating content generation from page layout and design tasks, JSP technology supports a tiered development approach that delivers faster, more efficient application development and deployment. A few Web developers can concentrate on the application functionality, creating cross-platform components and customized tag libraries for page authors, who in turn design and maintain the individual pages.

With this model, JSP technology provides many advantages:

  • Developers can offer customized JSP tag libraries that page authors access using an XML-like syntax. Because the JSP container takes care of compiling the page on demand, the page author can handle updates easily.
  • JSP pages can also access JavaBeans and Enterprise JavaBeansTM components that encapsulate sophisticated application logic, access to legacy data sources, and other more. These components, once written, are portable across platforms and servers. Re-using existing or off-the-shelf components (such as beans or customized tag libraries) speeds new application development.
  • Page authors can change and edit the fixed template portions of pages as frequently as needed - without affecting the application logic. Similarly, developers can make logic changes at the component level without editing the individual pages that use the logic.

Overall, using JSP technology along with servlets provides the tools to increase productivity, delegating page authoring tasks to those individuals responsible for pages.

Work With Your Existing Servlets

JSP technology is an extension of the servlet technology. JSP pages and servlets work together in many ways. Not only are JSP pages actually compiled into servlets, but JSP pages can include/forward servlets, and servlets, in turn, can include/forward JSP pages.

If you're already using servlets in your Web-based applications, JSP technology can provide faster deployment, easier maintenance, and better page authoring support. By separating the logic from the page design, JSP pages let others take responsibility for maintaining the individual pages while you maintain the core application logic components. Using customized tag libraries, you can distribute application functionality easily to a wide range of page authors, giving you more time to focus on application architecture and create new applications. In short, while servlets are serving your dynamic content needs today, JSP technology can bring significant long-term benefits to organizations deploying dynamic, Web-based applications.

Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.