Introduction of JSP:
JSP is one of the most powerful, easy-to-use, and
fundamental tools in a Web-site developer's toolbox. JSP combines HTML and XML
with Java TM servlet (server application extension) and JavaBeans technologies
to create a highly productive environment for developing and deploying reliable,
interactive, high-performance platform-independent Web sites.
JSP facilitates the creation of dynamic content on the server. It is part of the Java platform's integrated solution for server-side programming, which provides a portable alternative to other server-side technologies, such as CGI. JSP integrates numerous Java application technologies, such as Java servlet, JavaBeans, JDBC, and Enterprise JavaBeans. It also separates information presentation from application logic and fosters a reusable-component model of programming.
A common question involves deciding whether to use JSP vs. other Java server-side technologies. Unlike the client side, which has numerous technologies competing for dominance (including HTML and applets, Document Object Model (DOM)-based strategies such as Weblets and doclets, and more), the server side has relatively little overlap among the various Java server-side technologies and clean models of interaction.
JSPs released verson:
JSP has these versions: [TODO features and what is new]
J2EE 1.2 (December 12, 1999) (Java Servlet 2.2, JSP 1.1, EJB 1.1, JDBC 2.0)
J2EE 1.3 (September 24, 2001) (Java Servlet 2.3, JSP 1.2, EJB 2.0, JDBC 2.1)
J2EE 1.4 (November 11, 2003) (Java Servlet 2.4, JSP 2.0, EJB 2.1, JDBC 3.0)
Java EE 5 (May 11, 2006) (Java Servlet 2.5, JSP 2.1, JSTL 1.2, JSF 1.2, EJB 3.0, JDBC 3.0)
Java EE 6 (December 10, 2009) (Java Servlet 3.0, JSP 2.2/EL 2.2, JSTL 1.2, JSF 2.0, EJB 3.1, JDBC 4.0)
Java EE 7: in 2012
advantages of JSP:
|supports tag based programming.
strong java programming is not required.so,it is suitable for non-java programmers
gives 9 no of implicit objetcs and we can use them directly with additional code to access them.
allows to seperate presentation logic(html/code) from business logic(java code) exceptional handling is optional.
increases the readibility of code because of tags modifications will be reflected without re-compliation and re-loading
Gives built-in JSP tags and allows to develop custom JSP tags and to use third party supplied JSP tags
easy to learn and easy to apply.
JSP technology follows the write once run anywhere rule which is the basic of the java language
JSP uses pure java and takes the advantage of its object oriented nature.
JSP uses a combination of tags and scripting to create dynamic web pages.
The JSP page uses the components like EJB, JavaBeans which are reusable. This gives the JSP reusability capabilities.
Features of JSP 2.1
The main purpose of Java Platform, Enterprise Edition (Java EE) 5 is to ease development. Now the Jsp2.1 includes the Java Standard Tag Library(JSTL) and JavaServerFaces technology.
This version has new expression language (EL ) syntax that allows deferred evaluation of expressions. It now enables using the expression to both get and set data and to invoke methods, and facilitates customizing the resolution of a variable or property referenced by an expression.
It supports resource injection through annotations to simplify configuring access to resources and environment data.
It has complete alignment of JSF technology tags and JSP software code. Earlier the version 1.0 of jsf technology depended on jsp 1.2 technology. The reason is that the Jsp 1.2 was already available at the time, and the intension was to make the Jsf 1.0 interface more accessible to a broader audience. As jsp1.2 does not have an integrated expression language and because the Jsp 2.0 EL does not meet all of the needs of Jsf, therefore jsp2.1 was developed to enhance the expression language to meet the needs of Jsf technology.
Qualified functions now take precedence over the ternary operator when the "." operator in use or we can say that ability to redefine the behavior of the "."operator through a Property Resolver API.
EL now supports "literal expressions". The expression which were previously considered to be non-EL value text must now be considered an EL expression.
EL now supports Java 5.0 enumerations.
Ability to plug in Property Resolvers on a per-application and per-page basis.
Ability to express references to bean methods using the expression language and invoking those methods via a Method Binding API.
This version requires these jars:
New Features in JSP 2.0:
JSP 2.0 is released with new promises. JSP 2.0 is an upgrade to JSP 1.2 with several new and interesting features. These features makes the life of web application developers and designers easier.
The JavaServer Pages 2.0 Specification is fully backwards compatible with version 1.2. JSP 2.0 allows the developer to write script-free code without without declarations, scriptlets and expressions.
JSP 2.0 is released with the objective of making the life of Developers easy. Here is the new features of JSP 2.0:
.Simple Expression Language (EL)
.Simple Tag Handlers
.Easy tags creation with .tag files
.Easy Header and Footer template using the prelude and coda includes
With JSP 2.0 web develop has become easily and it also helps easily maintaining dynamic Web pages. Despite the fact the word "Java" appears in JavaServer Pages, with JSP 2.0 the developer can develop pages without learning Java programming language. Learning and using the features of JSP 2.0 is also very easy.
The description of the features is given below:
Simple Expression Language(EL): Expression Language (EL), provides a way to simplify expressions in JSP. EL provides the ability to use run-time expressions outside JSP scripting elements. Scripting elements are those elements which is used to embed Java code inside the JSP file. Mostly it contains the logic of the program. Scripting elements have three subforms:
Declaration: The variables and methods are declared inside declaration.
Scriptlets: The business logic of the program is written inside this.
Expressions: output will be displayed by the expression.
Expression Language can be enabled in scriptfree JSP pages:
|1). By using a page directive: We can
enable EL by using
<%@ page isScriptingEnabled="true|false" isEnabled="true|false"%>
2). By using an element of the deployment descriptor:
JSP Fragments: Jsp fragments is a new feature of
JSP 2.0 which allows page author to create custom action fragments that can be
invoked. The JSP fragments allows a portion of Jsp code to be encapsulated into
a Java object that can be passed around and evaluated zero or more times.
Methods for creating a JSP fragment:
1). Providing the body of a <jsp:attribute>:
<% attribute name="attributeName" fragment="true">
2). Providing the body of a tag invocation:
Simple Tag Handlers:
Easy tags creation with .tag files: With the introduction of JSP 2.0, knowledge of Java is no longer a prerequisite to create a custom tag action.
Easy Header and Footer template using the prelude and coda includes
With JSP 2.0 web development has become easy and it also helps in maintaining dynamic web pages easily. To learn JSP 2.0 there is no need to learn java.