JavaServer Faces in Software Generator Quick Response Code in Software JavaServer Faces

JavaServer Faces use software qr code integrated toaccess quick response code on software EAN8 In this chapter we QR Code JIS X 0510 for None will cover JavaServer Faces (JSF), the standard component framework of the Java EE platform. Java EE 6 includes JSF 2.0 (the latest version of JSF) as its standard user interface component framework.

Readers familiar with earlier versions of JSF will notice that JSF 2.0 includes a number of new features to make JSF application development simpler. Notably, JSF 2.

0 relies a lot on convention over configuration. If we follow JSF conventions, then we don"t need to write a lot of configuration. In most cases, we don"t need to write any configuration at all.

This fact, combined with the fact that web.xml is optional in servlet 3.0, means that in many cases we can write complete web applications without having to write a single line of XML configuration.

This means it is no longer necessary to write either a web.xml or a faces-config.xml file.

. Introduction to JSF 2.0 JSF 2.0 introduces qr barcode for None a number of enhancements to make JSF application development easier. In the following few sections, we explain some of these new features.

. Readers who are not familiar with earlier versions of JSF may not understand the following few sections completely. There"s nothing to worry about, everything will be perfectly clear by the end of this chapter..

Facelets One notable differe nce between JSF 2.0 and earlier versions is that Facelets is now the preferred view technology for JSF. Earlier versions of JSF used JSP as their default view technology.

As JSP technology predates JSF, sometimes using JSP with JSF felt unnatural or created problems. For example, the lifecycle of JSPs is different from the lifecycle of JSF. This mismatch introduced some problems for JSF 1.

x application developers.. JavaServer Faces JSF was designed fr om the beginning to support multiple view technologies. To take advantage of this capability, Jacob Hookom wrote a new view technology specifically for JSF. He named his view technology "Facelets".

Facelets was so successful that it became a de-facto standard for JSF. The JSF 2.0 expert group recognized Facelets" popularity and made it the official view technology for JSF 2.

0.. Optional faces-config.xml J2EE applications h ave suffered what some have considered to be excessive XML configuration. Java EE 5 took some measures to reduce XML configuration considerably. Java EE 6 reduces the required configuration even further, making the JSF configuration file, faces-config.

xml, optional in the latest version of JSF. In JSF 2.0, JSF managed beans can be configured via the new @ManagedBean annotation, obviating the need to configure them in faces-config.

xml. Additionally, there is a convention for JSF navigation. If the value of the action attribute of a JSF 2.

0 command link or command button matches the name of a facelet (minus the XHTML extension), then by convention the application will navigate to the facelet matching the action name. This convention allows us to avoid having to configure application navigation in faces-config.xml.

For most JSF 2.0 applications, faces-config.xml is completely unnecessary.

. Standard resource locations JSF 2.0 introduces standard resource locations. Resources are artifacts a page or JSF component needs to render properly.

Resource examples include CSS stylesheets, Javascript files, and images. In JSF 2.0, resources can be placed in a subdirectory under a folder called resources, either at the root of a WAR file or under META-INF.

By convention, JSF components know that they can retrieve resources from one of these two locations. In order to avoid cluttering the resources directory, resources are typically placed in a subdirectory. This subdirectory is referred to from the library attribute of JSF components.

. /resources/css/styles.css. For example, we could place a CSS stylesheet called styles.css under [ 204 ]. 6 . In our JSF pages, w Software qr-codes e could retrieve this CSS file using the <h:outputStylesheet> tag as follows:. <h:outputStylesheet library="css" name="styles.css"/> The value of the li QR Code JIS X 0510 for None brary attribute must match the subdirectory where our stylesheet is located. Similarly, we could have a javascript file under /resources/scripts/somescript.js and an image under /resources/images/logo.

png. We could access these resources as follows: And:. <h:graphicImage library="images" name="logo.png"/> <h:outputScript library="scripts" name="somescript.js"/>.

Notice that in each Software qr codes case the value of the library attribute matches the corresponding subdirectory name under the resources directory, and the value of the name attribute matches the resource"s filename..
Copyright © . All rights reserved.