Pages

Monday, July 12, 2010

JSP Overview

JSP is a popular Java technology for web application development and is based on servlet technology. A JSP page is a text document that contains two types of text - static data which can be expressed in any text-based format (HTML, SVG, XML, etc) and JSP elements (standard JSP or XML) which construct dynamic content.

A JSP page services requests as a servlet. In an application server, the source for the servlet created from a JSP named myPage is myPage_jsp.java. Once the JSP has been translated and compiled, the page's servlet follows the standard servlet lifecycle.

Expressions that are evaluated immediately use the ${ } syntax. Expressions that are differed use the #{ } syntax. Immediate evaluation expressions are always read-only value expressions.

Implicit objects include:
  • PageContext
  • Servlet Context
  • Session
  • Request
  • Response
  • etc.
JSP technology directly supports JavaBeans components with standard JSP language elements:
  • The JSP:useBean element declares that the page will use a bean that is stored within and is accessible from the specified scope (application, session, request, or page)
  • jsp:setProperty
  • jsp:getProperty
Custom tags are user-defined JSP language elements that encapsulate recurring tasks. A tag handler is an object that implements a custom tag. When a JSP page containing a custom tag is translated into a servlet, the tag is converted into operations on a tag handler. The web container then invokes those operations when the JSP page's servlet is executed.

To declare that a JSP page will use tags defined in a tag library, include the taglib directive.

An Applet or JavaBeans component can be included in a JSP by using the jsp:plugin element.

0 comments:

Post a Comment

 
Powered by Blogger