JavaServer Pages (JSP) is an extension of Java Servlet technology that
provides one approach to dynamic content generation. The JSP acronym
suggests it was inspired by Microsoft's ASP (Active Server Pages). Classic
JSP employs Java as the server-side web page scripting language, whereas ASP
uses BASIC for scripting.
The Problem with Servlets:
Java Servlets provide an elegant interface for handling the HTTP Internet
protocol. But servlets do not provide a reasonable way to generate
web pages. A bare bones servlet generates HTML with Java println
statements one line at a time. This approach to embedding
HTML within Java is a cumbersome way to lay out a web page.
Programming in JSP:
JSP reverses the paradigm by embedding Java within HTML.
Java scriptlets are embedded in JSP pages with non-standard
tags (neither HTML or XML). But experience has shown that mixing Java
and HTML in this way results in web pages that are difficult to design
and maintain.
A newer JSP approach is to use tag libraries that hide Java code
behind XML tags. JSP Standard Tag Library (JSTL), Expression Language (EL),
and Java Server Faces (JSF) have transformed JSP into a feature-rich
XML programming language reminiscent of Awk or Perl.
Effective use of these JSP programming features requires training and
experience with object-oriented software concepts. This evolution of JSP
is similar to past attempts at 4GL (fourth generation) languages for
non-programmers. Instead, as happened with 4GL's, a new language has
emerged that requires a new type of specialized JSP programmer.
Problems with JSP:
There are many server-side approaches for generating dynamic
content (see comparisons).
JSP's evolving architecture has created layers of technology for programmers
to grapple with (Java, and scriptlets, and tag libraries, and expression
language, and Struts, and now Java Server Faces).
A central concern is the failure of JSP to separate page
layout (presentation) from programming logic. JSP has replaced Java
scriptlets with an equally complex expression language and XML programming
tags. Java Server Faces (JSF) continues this trend of moving
programming syntax into the web page, intermixing programming
constructs with the presentation view. Problems with JSP have been
discussed elsewhere (see
Hunter).