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.

C H A P T E R 11■ ■ ■Pages and ComponentsIn the early days of <strong>Java</strong>, developers dealt <strong>with</strong> HTML directly, by emitting HTML from servlets. We thenmoved from servlets to <strong>Java</strong> Server Pages (JSP) to custom tags. Today, <strong>Java</strong> <strong>EE</strong> 6 brings a new version ofJSF, simplifying web interface development.In this chapter, you will see different technologies used in <strong>Java</strong> <strong>EE</strong> 6 to create web pages. First, thetext covers some basic concepts such as HTML, CSS, and <strong>Java</strong>Script, and then moves on to JSP, EL, andJSTL. I then introduce you to Facelets, the preferred page declaration language (PDL) in JSF. Theremainder of the chapter focuses on how to create web interfaces using JSF or custom components. Thenext chapter will focus on how to navigate between pages and how to interact <strong>with</strong> a back end so thatdynamic data can be displayed.Web PagesWhen we create a web application, we are really interested in displaying dynamic content: a list of itemsfrom a catalog (CDs and books, for instance), the customer details for a given identifier, a shopping cartcontaining the items the customer wants to buy, and so on. Conversely, static content, such as theaddress of a book company and FAQs <strong>with</strong> information on how to buy or ship items, rarely or neverchanges. Static content can also be the images, videos, or artwork that make up a page.The final goal of creating a page is to display it in a browser. The page has to use languages that thebrowser can understand, of which there are several: HTML, XHTML, CSS, and <strong>Java</strong>Script.HTMLHypertext Markup Language (HTML) is the predominant language for web pages. It is based onStandard Generalized Markup Language (SGML), which is a standard metalanguage to define markuplanguages. HTML uses markups, or tags, to structure text into paragraphs, lists, links, buttons, text areas,and so on.An HTML page is a text document used by browsers to present text and graphics. These documentsare text files that often have an .html or .htm extension. A web page is made of content, tags to changesome aspects of the content, and external objects such as images, videos, <strong>Java</strong>Script, or CSS files.In Chapter 10, the “Putting It All Together” section showed a couple of JSF pages, <strong>with</strong> onedisplaying a form to create a new book. In pure HTML, <strong>with</strong>out using any JSF tags, this page could looklike the code in Listing 11-1.297

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

Saved successfully!

Ooh no, something went wrong!