Jsp Tutorial Home

Jsp Home

JSP Resources

Community

Site

JSTL is a component technology within the Java 2 Enterprise Edition (J2EE) specification and is controlled by Sun Microsystems. JSTL is nothing more than a set of simple and standard tag libraries that encapsulates the core functionality commonly needed when writing dynamic JSP pages. The following are the problems with the JSPs:-



  1. Java code embedded within scriptlet tags is ugly and obtrusive.

  2. It is very difficult to modify the java code embedded in the JSP files if the file is large.

  3. Java code within JSP scriptlets cannot be reused by other JSP pages.

  4. Retrieving objects out of the HTTP request and session is cumbersome and type casting to the object's class is required.


The JSTL tags are basically categorized into four libraries:



  • core:- Basic scripting functions such as loops, conditionals, and input/output.

  • fmt:- Internationalization and formatting of values such as currency and dates.

  • xml:- XML processing

  • sql:- Database access.


Advantages of using JSTL:-



  • JSTL tags are XML based tags which are cleanly and uniformly blend into a page's HTML markup tags.

  • The four JSTL tag libraries include most functionality that would be needed in a JSP page. JSTL tags are easier for non-programmers and inexperienced programmers, because they do not require any knowledge of Java programming.

  • JSTL tags encapsulate reusable logic such as formatting dates and numbers.

  • JSTL tags can reference objects in the request and session without knowing the object's type and no casting is required.

  • JSP's EL (Expression Language) makes it easy to call getter and setter methods on Java objects. This is not possible in JSP 1.2, but became available in JSP 2.0. EL is used extensively in JSTL.


JSTL Drawbacks:



  • JSTL can add processing overhead to the server. Both Java scriptlet code and tag libraries are compiled into a resulting servlet, which is then executed by the servlet container. Java code embedded in scriptlet tags is directly copied into the resulting servlet. But JSTL tags add more than required code to the servlet.

  • Although JSTL provides a powerful set of reusable libraries, it cannot do everything that Java code can do. It is designed to facilitate scripting the presentation code that is typically found in the view tier of Model-View-Controller applications.

                    

Copyright © 2010 VisualBuilder. All rights reserved