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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 11 ■ PAGES AND COMPONENTSAll these implicit objects are actual objects <strong>with</strong> interfaces, and, once you know what they are (referto the specification), you can access their attributes <strong>with</strong> EL. For example, #{view.locale} will get thelocale of the current view (en_US, pt_PT, etc.). If you store a book object in the session scope, you couldaccess it like this: #{sessionScope.book}. You can even use a richer algorithm to display all the HTTPheaders and their values as follows:Listing 11-15. A Page Displaying the HTTP Headers Using the headerValues Implicit ObjectheaderValues =If you execute this page, you will get a page that shows all the HTTP headers.SummaryThis chapter explained the different ways of creating web pages using static languages such asHTML, XHTML, or CSS and dynamic ones such as <strong>Java</strong>Script or server-side technologies. To createdynamic web interfaces <strong>with</strong> <strong>Java</strong> <strong>EE</strong> 6, you can choose from several specifications. JSP 2.2, EL 2.2, andJSTL 1.2 are specifications that were created <strong>with</strong> servlets in mind. Pages consist of HTML data and <strong>Java</strong>code compiled into servlets that send back a response to a given request.Even though JSP can serve as a JSF PDL, it is better to use Facelets to achieve the power of the JSFcomponent-based architecture and rich life cycle. JSF provides a set of standard widgets (buttons,hyperlinks, check boxes, etc.) and a new model for creating your own widgets (composite components).JSF 2.0 also provides a new resource-handling mechanism, allowing you to easily version and localizeyour external resources.JSF 2.0 uses a rich UI component architecture, and its components can be converted and validated,and can interact <strong>with</strong> managed beans. This will be the topic of the next chapter.343

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

Saved successfully!

Ooh no, something went wrong!