Difference between JSP 2.0 & JSP 2.1

JSP 2.0 is released with new promises. JSP 2.0 is a upgrade version of JSP 1.2 with several new and interesting features. This version is fully compatible with JSP1.2.

Difference between JSP 2.0 & JSP 2.1

Difference between JSP 2.0 & JSP 2.1

        

Features of Jsp 2.0

JSP 2.0 is released with new promises. JSP 2.0 is a upgrade version of JSP 1.2 with several new and interesting features. This version is fully compatible with JSP1.2. These features have been added to make the life of web application developers and designers easier. The main objective of the JSP 2.0 is to make JSP easier than ever, it has been made in such a way that it can be learn without the knowledge of Java. After going through this tutorial you will be better understand the features added in JSP 2.0.

The Features in JSP 2.0 are:

  1. 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-config>
      <jsp-property-group>
      <url-pattern>*.jsp</url-pattern>
      <el-enabled>true</el-enabled>
      <scripting-enabled>true</scripting-enabled>
      </jsp-property-group>
      </jsp-config>
     

  2. 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:
  3. Simple Tag Handlers: 
  4. 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. 
  5. 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. 

 

Features of jsp2.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. 

  1. 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.
  2. It supports resource injection through annotations to simplify configuring access to resources and environment data.
  3. 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.
  4. 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.
  5. EL now supports "literal expressions". The expression which were previously considered to be non-EL value text must now be considered an EL expression.
  6. EL now supports Java 5.0 enumerations.
  7. Ability to plug in Property Resolvers on a per-application and per-page basis.
  8. 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:

1) ant-1.6.5.jar

2) core-3.1.1.jar

3 jsp-2.1.jar

4) jsp-api-2.1.jar