12.07.2015 Views

Beginning Java EE 6 with GlassFish 3, Second Edition

Beginning Java EE 6 with GlassFish 3, Second Edition

Beginning Java EE 6 with GlassFish 3, Second Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 11 ■ PAGES AND COMPONENTS// orThe include directive is used to include another page (HTML, XHTML, or JSP) <strong>with</strong>in the currentpage. You use this directive when you have a standard page (such as a header or a footer) you wantincluded in multiple JSPs.// orThe “JSP Standard Tag Library” section shows that JSPs can be extended through a tag library. Thetaglib directive in a JSP declares the page uses a certain tag library, uniquely identified by a URI and aprefix. In XML, it translates into a unique namespace (xmlns) at a given URI. In the following example,the http://java.sun.com/jstl/core tag library is made available to a page using the prefix c:// orScripting ElementsScripting elements are used to manipulate objects and to perform computation that affects the contentby including <strong>Java</strong> code. There are three categories of scripting elements: declarations, scriptlets, andexpressions. These can be defined following two different syntaxes.// orthis is a declaration// orthis is a scriptlet// orthis is an expressionDeclarations are used to declare <strong>Java</strong> variables or methods that are available to all other scriptingelements of the page. The declaration appears only <strong>with</strong>in the translated JSP (i.e., the servlet) but not inthe output to the client. Any variable or method declared <strong>with</strong>in a declaration element becomes aninstance method of the JSP and is global to the entire page. For example, you declare an ArrayList asfollows:// orList books = new ArrayList();308

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!