Appendix L.1 Using JSF
(1) Setting up the user library
To set up the user library:
- From the Eclipse menu bar, choose Window - Preferences.
The Preferences dialog box appears.
- In the left pane of the Setting dialog box, choose Java - Build path - User Libraries.
The User Libraries page appears.
![[Figure]](figure/zu0l0110.gif)
- Click the New button.
The New User Library dialog box appears.
![[Figure]](figure/zu0l0120.gif)
- Specify any name in the User library name, and then click the OK button.
The user library created in Defined user library appears.
- Select user library created in Defined user library, and then click the Add JARs button.
The Select JAR dialog box appears.
- In the Select JAR dialog box, specify the jar to be added to file name, and then click the Open button.
The jar specified in created user library is added.
The jars to be added to the user library are as follows:
- Developer-installation-directory\CC\lib\cjsf.jar
- Developer-installation-directory\CC\lib\cjstl.jar
- Developer-installation-directory\CC\lib\validation-api.jar
- In the Setting dialog box, click the OK button.
The settings are saved.
- Note
- In the debug environment, if you want to execute a J2EE application that uses JSF, J2EE server side settings are required for the following jars:
- Developer-installation-directory\CC\lib\cjsf.jar
- Developer-installation-directory\CC\lib\cjstl.jar
- For details on settings, see 3.4 Settings of the class path (Setting up the development environment) in the uCosminexus Application Server Web Container Functionality Guide.
(2) Setting up the facet
To set the facet:
- In the Project Explorer view, choose the dynamic Web project using JSF.
- From the Eclipse menu bar, choose Project - Property.
The Property: Project-name dialog box appears.
- In the left pane of the Property: Project-name dialog box, choose Project Facets.
The Project Facets page appears.
![[Figure]](figure/zu0l0210.gif)
- In the Project Facets page, check JavaServer Faces and then choose "2.0" or "2.1" in the version.
On the Project Facet page, the Further configuration required link or the Further configuration available link is displayed.
If "2.1" is specified in version, additional procedures are required after setting up the facet. For details on additional procedures, see (3) Settings required when using JSF 2.1.
![[Figure]](figure/zu0l0220.gif)
- Click the link displayed in step 4.
The Modify Faceted Project dialog box appears.
![[Figure]](figure/zu0l0230.gif)
- In the Modify Faceted Project dialog box, specify the following items:
- Select User Library from Type.
- In the displayed user library list, check the user library of the created JSF.
- Deselect Include libraries with this application.
- Click the OK button.
- In the Property: Project-Name dialog box, click the OK button.
(3) Settings required when using JSF 2.1
The additional steps when using JSF 2.1 are as follows:
- Open faces-config.xml in editor.
- Change the version.
Change the following items:
- Change the version attributes of <faces-config> tag from "2.0" to "2.1".
- Change the schema file name of xsi:schemaLocation attribute from web-facesconfig_2_0.xsd to web-facesconfig_2_1.xsd
- Add when using the elements added to JSF 2.1.
Add the elements added to JSF 2.1.
In an environment where internet connection is available, you can add elements using content assist in the Source tag or Outline view.
(4) Notes on editing web.xml
If you are performing the settings to use JSF, the following definitions are set in web.xml. Modify or delete the definitions.
- <context-param> tag
- javax.faces.STATE_SAVING_METHOD
The "client" is specified. Perform the modifications on "server" as and when required.
- javax.servlet.jsp.jstl.fmt.localizationContext
Modify or delete as and when required.
- <listener> tag
- com.sun.faces.config.ConfigureListener
Delete this tag as you need not set this tag in web.xml.