Sunday, 18 December 2011

Scripting in JSP Pages

JSP scripting elements allow you to use Java programming language statements in your JSP pages. Scripting elements are typically used to create and access objects, define methods, and manage the flow of control. Many tasks that require the use of scripts can be eliminated by using custom tag libraries, in particular the JSP Standard Tag Library. Because one of the goals of JSP technology is to separate static data from the code needed to dynamically generate content, very sparing use of JSP scripting is recommended. Nevertheless, there may be some circumstances that require its use.
There are three ways to create and use objects in scripting elements:
  • Instance and class variables of the JSP pages servlet class are created in declarations and accessed in scriptlets and expressions.
  • Local variables of the JSP page's servlet class are created and used in scriptlets and expressions.
  • Attributes of scope objects (see Using Scope Objects) are created and used in scriptlets and expressions.

No comments:

Post a Comment