[an error occurred while processing this directive]

Features of Servlet 2.5

                         

This version has been released on September 26, 2005 by the Sun MicroSystems. It is not necessary that all web servers and application servers support the features of Servlet 2.5. Still most of the popular containers like Tomcat 5.5 and JBoss 4.0 support Servlet 2.4

The list of the added features is given below:

  1. Dependency on J2SE 5.0: The minimum platform requirement for Servlet 2.5 is JDK 1.5. Servet 2.5 can't be used in versions below than JDK1.5. All the available features of JDK1.5 like generics, autoboxing, an improved for loop etc are guaranteed available to Servlet 2.5 programmers. 
  2. Support For annotations: Annotations provide a mechanism for decorating java code constructs (classes, methods, fields, etc.) with metadata information. Annotations are mark code in such a way that code processors may alter their behavior based on the metadata information. 
  3. Several web.xml convenience: Servlet 2.5 introduces several small changes to the web.xml file to make it more convenient to use.  For example while writing a <filter-mapping>, we can now use an asterisk in a <servlet-name> which will represent all servlets as well as JSP. 

    Previously we used to do

    <filter-mapping>
    <filter-name>FilterName</filter-name>
    <servlet-name>FilterName</servlet-name>
    </filter-mapping> 

    Now,

    <filter-mapping>
    <filter-name>FilterName</filter-name>
    <servlet-name>*</servlet-name>
    </filter-mapping> 
     
    Previously in <servlet-mapping> or <filter-mapping> there used to be only one <url-pattern>, but now we can have multiple <url-pattern>, like

    <servlet-mapping>
        <servlet-name>abc</servlet-name>
        <url-pattern>/abc/*</url-pattern>
        <url-pattern>/abc/*</url-pattern>
    </servlet-mapping>

    Apart from these changes, many more facilities added in web.xml.
  4. A Handful of removed restrictions: Servlet 2.5 removed a few restrictions around error handling and session tracking. Now it has removed the restriction that the <error-page> could not call the setStatus() method to alter the error code that triggered them. In session tracking, Servlet 2.5 eased a rule that a servlet called by RequestDispatcher include() couldn't set response headers.
  5. Some edge case clarifications: The servlet 2.4 specification says that before calling request.getReader() we  must call request.setCharacterEncoding().  However there is no such clarification given why it is so.

 

                         

[an error occurred while processing this directive]