JSP.4.4 Main Section


This section provides the main mapping between a request and a response object.

The contents of code segment 2 in Table JSP.4-1 are determined from scriptlets, expressions, and the text body of the JSP page. These elements are processed sequentially; a translation for each one is determined as indicated below, and its translation is inserted into this section. The translation depends on the element type:

  1. Template data is transformed into code that will place the template data into the stream currently named by the implicit variable out . All white space is preserved.

    Ignoring quotation issues and performance issues, this corresponds to a statement of the form:

     out.print(  template  ); 
  2. A scriptlet is transformed into its Java statement fragment.

  3. An expression is transformed into a Java statement to insert the value of the expression, converted to java.lang.String if needed, into the stream currently named by the implicit variable out . No additional newlines or space is included.

    Ignoring quotation and performance issues, this corresponds to a statement of the form:

     out.print(  expression  ); 
  4. An action defining one or more objects is transformed into one or more variable declarations for these objects, together with code that initializes these variables. The visibility of these variables is affected by other constructs, like the scriptlets.

The semantics of the action type determines the name of the variables (usually that of the id attribute, if present) and their type. The only standard action in the JSP 1.1 specification that defines objects is the jsp:useBean action; the name of the variable introduced is that of the id attribute, its type is that of the class attribute.

Note that the value of the scope attribute does not affect the visibility of the variables within the generated program; it affects only where (and thus for how long) there will be additional references to the object denoted by the variable.



Java 2 Platform, Enterprise Edition. Platform and Component Specifications
Java 2 Platform, Enterprise Edition: Platform and Component Specifications
ISBN: 0201704560
EAN: 2147483647
Year: 2000
Pages: 399

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net