From jbosstools-commits at lists.jboss.org Wed Feb 17 14:33:15 2010
Content-Type: multipart/mixed; boundary="===============4312792368139628346=="
MIME-Version: 1.0
From: jbosstools-commits at lists.jboss.org
To: jbosstools-commits at lists.jboss.org
Subject: [jbosstools-commits] JBoss Tools SVN: r20333 -
trunk/jsf/docs/jsf_tools_ref_guide/en.
Date: Wed, 17 Feb 2010 14:33:15 -0500
Message-ID: <201002171933.o1HJXFhX017284@svn01.web.mwc.hst.phx2.redhat.com>
--===============4312792368139628346==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: ochikvina
Date: 2010-02-17 14:33:14 -0500 (Wed, 17 Feb 2010)
New Revision: 20333
Modified:
trunk/jsf/docs/jsf_tools_ref_guide/en/master.xml
trunk/jsf/docs/jsf_tools_ref_guide/en/master_output.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-1104 - Updated versions,correcte=
d master_output file
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en/master.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/jsf/docs/jsf_tools_ref_guide/en/master.xml 2010-02-17 19:27:34 UT=
C (rev 20332)
+++ trunk/jsf/docs/jsf_tools_ref_guide/en/master.xml 2010-02-17 19:33:14 UT=
C (rev 20333)
@@ -45,14 +45,14 @@
SvetlanaMukhina<=
email>smukhina(a)exadel.com
=
- 2007
+ 20072008
- 2009
+ 20092010JBoss by Red Hat
- Version: 3.1.0.CR1
+ Version: 3.1.0.CR2
=
@@ -74,4 +74,4 @@
&managed_beans;
&creation_and_registration;
&jsf_project_verification;
- =
+ =
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en/master_output.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/jsf/docs/jsf_tools_ref_guide/en/master_output.xml 2010-02-17 19:2=
7:34 UTC (rev 20332)
+++ trunk/jsf/docs/jsf_tools_ref_guide/en/master_output.xml 2010-02-17 19:3=
3:14 UTC (rev 20333)
@@ -26,1960 +26,1962 @@
=
=
=
=
-]>
-
- JSF Tools Reference Guide
-
-
-
-
- =
-
-
- =
- =
-
- AnatolyFedosik=
author>
- OlgaChikvina
- SvetlanaMukhina<=
email>smukhina(a)exadel.com
- =
- April 2008
-
- 2007
- 2009
- JBoss by Red Hat
-
-
- Version: 3.1.0.CR1
-
-
-
-
-
- PDF version
-
-
-
-
- =
- =
- =
- =
-
-
-
-
-
- JBoss Developer Studio
- Eclipse
- Java
- JBoss
- JSF Tools
-
-
-
- Introduction
-
- JSF Tools are especially designed for supporting JSF and JSF-rel=
ated technologies. JSF
- Tools provide extensible and exemplary tools for building JSF-base=
d applications as well as
- adding JSF capabilities to existing web projects, importing JSF pr=
ojects and choosing any
- JSF implementation while developing JSF application.
-
- In this guide we provide you with the information on JSF tooling=
which allows you to
- develop JSF applications much faster and with far fewer errors so =
sparing your time.
-
-
- Key Features of JSF Tools
-
- Here, we provide you with a key functionality which is integ=
rated in JSF tooling.
-
-
- Key Functionality for JSF Tools
-
-
-
-
-
-
-
-
- Feature
- Benefit
- Chapter
-
-
-
- =
-
- JSF and Facelets support
- Step-by-step wizards for creating new JSF a=
nd Facelets projects with a number of predefined templates, importing exist=
ing ones and adding JSF capabilities to non-jsf web projects.
- jsf support=
link>
-
-
-
- Flexible and customizable project template =
management
- Jump-start development with out-of-the-box =
templates or easily
- customized templates for re-use.
-
- projects
-
-
-
-
- Support for JSF Configuration File
- Working on file using three modes: diagram,=
tree and source.
- Synchronization between the modes and full con=
trol over the code. Easy
- moving around the diagram using the Diagram Na=
vigator.
-
- graphical ed=
itor for jsf
-
-
-
-
- Support for Managed Beans
- Adding new managed beans, generating code f=
or attributes, properties
- and getter/setter methods.
-
- managed beans<=
/link>
-
-
-
-
- Support for Custom Converters and Validator=
s
- Fast creating of custom converters and vali=
dators with tree view of
- faces-config.xml file.
-
- co=
nverters and validators
-
-
-
-
- Verification and Validation
- All occuring errors will be immediately rep=
orted by verification
- feature, no matter in what view you are workin=
g. Constant validation and
- errors checking allows to catch many of the er=
rors during development
- process that significantly reduces development=
time.
-
- ver=
ification and
- validation
-
-
-
-
-
-
-
-
- Other relevant resources on the topic
- All JBoss Developer Studio/JBoss Tools release documentation=
you can find athttp://docs.jbo=
ss.org/tools in the corresponding release directory.
- The latest documentation builds are available at http://download.jbo=
ss.org/jbosstools/nightly-docs.
-
-
-
- =
-
-
-
-
- JBoss Developer Studio
- Eclipse
- JSF Tools
- Java
- JBoss
-
-
-
- JavaServer Faces Support
-
- We don't lock you into any one J=
avaServer
- Faces implementation. You can always se=
lect the one which is
- necessary for you while =
creating a new JSF
- project, addin=
g JSF capability to
- any existing Eclipse project or importing existing JSF projects as well.<=
/para>
- At this point the special wizard will prompt you to specify =
a proper JSF environment.
- It may be JSF 1.1.02 RI or JSF 1.2 which integrates a numb=
er of new features and
- changes. The wizard also lets you select JSF implementatio=
n with a component
- orientation such as JSF 1.2 with Facelets or MyFaces 1.1.4=
.
-
-
- Choosing JSF Environment
-
-
-
-
-
-
-
- After specifying a proper JSF environment all the required l=
ibraries for the selected
- version will be added to your project.
-
-
-
- Facelets Support
- In this section we will focus more on all concepts t=
hat are integrated for
- working with Facelets.
-
- The Facelets extends JavaServer Faces by providing a=
lightweight framework
- that radically simplifies the design of presentati=
on pages for JSF. Facelets can be used in a variety of ways that we
- will consider further in this section.
-
-
- Facelets templates
- If you want to build an application using Fa=
celets, just create a
- project with Facelets based on version 1.2=
of the JSF Reference
- Implementation, i. e. select the
- JSF 1.=
2 with Facelets
- in the JSF Environment section=
of the New JSF Project
- wizard.
-
-
- Choosing Facelets Environment
-
-
-
-
-
-
-
- Once you've selected the environment, it's p=
ossible
- to specify the one of three available temp=
lates:
-
- Choosing Facelets Template
-
-
-
-
-
-
- The following table lists possible templates=
with Facelets for any JSF
- project and gives a proper description for=
each one.
-
- Facelets Templates
-
-
-
-
-
-
-
-
- Template
-
-
-
- Description
-
-
-
-
-
-
-
-
-
-
- FaceletsBlankWithoutLibs
-
-
-
-
-
- Some servers alrea=
dy provide
- jsf libs and you take ri=
sk
- of getting conflicting
- libraries while deploying
- your project. To avoid s=
uch
- conflicts, use a template
- without libs if you have=
a
- server with its own jsf
- libraries
-
-
-
-
-
-
-
- FaceletsKickStartWithRILibs
-
-
-
-
-
- A sample applicati=
on with
- Facelets that is ready to
- run
-
-
-
-
-
-
-
- FaceletsKickStartWithoutLibs
-
-
-
-
-
- A sample applicati=
on without
- libraries
-
-
-
-
-
-
-
-
- Facelets components
-
- The JBoss Tools
- Palette comes with the Fac=
elets components ready to
- use. A useful tip appears when you hover t=
he mouse cursor over the
- tag, the tip includes a detailed descripti=
on of the tag component,
- the syntax and available attributes.
-
-
-
- Facelets Components
-
-
-
-
-
-
-
-
- Code assist for Facelets
-
- One more feature which comes with Facelets s=
upport is code assist
- (Ctrl + Space). It is available for Facelets
- tags while editing
- .xhtml=
- files.
-
-
- XHTML File Code Assist
-
-
-
-
-
-
-
- What's more, code assist is also available f=
or
- "jsfc"=
- attribute in any HTML tag.
-
-
- Code Assist for JSFC Attribute
-
-
-
-
-
-
-
- After selecting
- "jsfc"=
- you get the code assist for JS=
F components available on
- a page.
-
-
- Code Assist for JSF Components
-
-
-
-
-
-
-
- When a component is chosen you will see all =
available attributes for
- it.
-
-
- Available Attributes for the Compon=
ent
-
-
-
-
-
-
-
-
- Open On feature
- Finally, Eclipse's
- OpenOn=
- feature for editing Facelets f=
iles is supported. Using this feature,
- you can easily navigate between the Facelets
- templates and other parts of yo=
ur projects. Just by
- holding down the Control key while hoverin=
g the mouse cursor over a
- reference to a template, the reference bec=
omes a hyperlink to open
- that template.
-
-
-
- Template Hyperlink
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- =
-
-
-
-
- JBoss Developer Studio
- Eclipse
- JSF Tools
- Java
- JBoss
-
-
-
- Projects
- To take an advantage of JSF firstly you should perform one o=
f the next steps:
-
-
-
- Create new JSF projects
-
-
- Import (open) existing JSF projects
-
-
- Add JSF capability to any existing Eclipse p=
roject
-
-
- Import and add JSF capability to any existin=
g project created outside
- Eclipse.
-
-
- In this section we're going to stop on each of them in detai=
l.
-
-
-
- Creating a New JSF Project
-
- If you want your project to already contain all JSF =
libraries, tag libraries
- and JSF configuration file, just organize a new br=
and JSF project. It is
- possible to do this easily with the help of the sp=
ecial wizard. To get it, select
- File > New=
> Project > JBoos Tools
- Web > JSF > JSF Project
- and click
- Next.
-
-
- Choosing a JSF Project
-
-
-
-
-
-
-
- On the next form you'll be prompted to enter Project
- Name and select a location for =
the project or just leave
- a default path.
- Here, JSF Version also allows you to select which JS=
F implementation to
- use.
-
- Creating a New JSF Project
-
-
-
-
-
-
-
- There is a number of predefined project templates th=
at are flexible and easily
- customizable. Thus you can pick a different templa=
te on which the projects
- Importing Existing should be based on. Almost all =
templates come in two
- variations: with jsf libraries and without ones.=
para>
-
- Choosing JSF Templates
-
-
-
-
-
-
-
- The table below provides description for each possib=
le JSF template.
-
- JSF Project Templates
-
-
-
-
-
-
-
-
- Template
-
-
-
- Description
-
-
-
-
-
-
-
-
-
-
- JSFBlankWithLibs
-
-
-
-
-
- This template will=
create a standard Web
- project structure with a=
ll JSF capabilities
-
-
-
-
-
-
-
- JSFKickStartWithLibs
-
-
-
-
-
- This template will=
create a standard Web
- project structure but wi=
ll also include a sample
- application that is read=
y to run
-
-
-
-
-
-
-
- JSFKickStartWithoutLibs
-
-
-
-
-
- Some servers alrea=
dy provide jsf libs and
- you take risk of getting=
conflicting libraries
- while deploying your pro=
ject. To avoid such
- conflicts, use a templat=
e without libs if you have
- a server with its own js=
f libraries
-
-
-
-
-
-
-
-
-
-
- On the next screen select what
- Servlet versio=
n
- to use and whether to register this ap=
plication with JBoss AS
- (or other server) for running and testing your app=
lication.
-
- The
- Context Path=
property>
- is the name under which the applicatio=
n will be deployed.
-
- The
- Runtime
- value tells Eclipse where to find Web =
libraries in order to
- build (compile) the project. It is not possible to=
finish project creation
- without selecting Runtime. If you don't have any v=
alues, select
- New...
- to add new Runtime.
-
- The
- Target Server<=
/property>
- allows you specifying whether to deplo=
y the application. The
- Target Server corresponds to the Runtime value sel=
ected above. If you
- don't want to deploy the application, uncheck this=
value.
-
- Registering the Project on Server
-
-
-
-
-
-
-
- When you are all done, you should have the project t=
hat has been appeared in
- the Package Explorer view:
-
- A New Project in the Package Explorer
-
-
-
-
-
-
-
- At this point you can open
- faces-config.x=
ml
- and start working on your application.=
There are a lot of
- features to develop JSF applications. We will desc=
ribe the features
- further.
-
-
-
-
- Importing Existing JSF Projects with Any Structure<=
/title>
-
- For detailed information on migration of JSF project=
s into a workspace see
- Migration
- Guide.
-
-
-
-
- Adding JSF Capability to Any Existing Eclipse Proje=
ct
-
- It's also possible to add JSF capability (JSF
- libraries, tag libraries) to any existing Eclipse =
project in your workspace.
- After that you'll be able to make use of such edit=
ors as JSF
- configuration editor, JBoss Tools JSP editor and a=
ny others.
- Right click the project and select
- JBoss Tools &g=
t; Add JSF Capabilities.
- This will start the process of adding all necessar=
y libraries, files to make
- this a Web JSF project.
-
- Adding JSF Capabilities
-
-
-
-
-
-
- The wizard will first ask you to show the
- web.xml
- file location and the project name.
-
- Project Location
-
-
-
-
-
-
- On the last form you can set the different folders f=
or your project as well as
- register this application with a servlet container=
.
-
- Make sure to select
- Add Libraries<=
/property>
- to add all required JSF related librar=
ies to this
- project.
-
- The
- Context Path=
property>
- is the name under which the applicatio=
n will be deployed.
-
- The
- Runtime
- value tells Eclipse where to find Web =
libraries in order to
- build (compile) the project. It is not possible to=
finish project import
- without selecting Runtime. If you don't have any v=
alues, select
- New...
- to add new Runtime.
-
- The
- Target Server<=
/property>
- allows you to specify whether to deplo=
y the application. The
- Target Server corresponds to the Runtime value sel=
ected above. If you
- don't want to deploy the application, uncheck this=
value.
-
- Project Folders
-
-
-
-
-
-
- Once your project is imported you can see that JSF r=
elated libraries have been
- added to your project:
- jsf-api.jar
- and
- jsf-impl.jar=
property>
- .
-
- Note:
- Some application servers provide their own j=
sf implementation
- libraries. Thus, to avoid conflicts you sh=
ould not add jsf libraries
- while adding jsf capabilities.
-
- You are now ready to work with JSF by creating a new=
JSF configuration
- file:
-
-
-
- Creating a New JSF Configuration File
-
-
-
-
-
-
-
- Once the file has been created, it should be opened =
in a special Faces Config Editor.<=
/para>
-
-
-
- Adding Your Own Project Templates
- Template is a set of files that is served as a basis=
to facilitate the
- creation of a new project. Project templates provi=
de content and structure
- for a project.
- There is a powerful templating capability for creati=
ng new and importing
- existing Struts and JSF projects. This templating =
facility has a variety of
- aspects to consider. But, let's start with the mos=
t straightforward
- case and consider the process of creating a templa=
te from your existing JSF
- project.
-
- Let's say you have a project that you want to use as=
the basis for a
- new template. Follow these steps to make a template out
- of it:
-
-
- In the Web Projects view, right-clic=
k the project and select
- JBoss Tools JSF > Save As
- Template
-
-
-
-
- Saving Your Project as Template
-
-
-
-
-
-
-
-
- In the first dialog box, you can cho=
ose a name for the
- template (defaults to the project =
name) and confirm what
- run-time implementation of the pro=
ject technology will be
- used
-
-
-
-
- Define Template Properties
-
-
-
-
-
-
-
-
-
-
- Select
- Next
- and you will be sent t=
o a dialog box with your
- project structure displayed with c=
heck boxes. Here you can
- check only those parts and files i=
n your project directory
- that should be part of the templat=
e
-
-
-
- Define Template Properties
-
-
-
-
-
-
-
-
- At this point, unless you want to de=
signate some extra files
- as having Velocity template coding=
inside them, you should
- click
- Finish
- .
-
-
- That's it. Now, you can use this template with any n=
ew or imported
- project that uses the same run-time implementation=
as the project you turned
- into a template.
- At this point, you have a fully configured project a=
nd now you can bring some
- new logic to it starting from JSF configuration fi=
le.
-
-
- Relevant Resources Links
-
- You can find more in-depth explanation on how to wor=
k with special wizards, editors and views that can
- be used in various scenarios while developing JSF =
applications in our Visual =
Web Tools guide.
-
-
-
- =
-
-
-
-
- JBoss Tools
- JSF Tools
-
-
- =
- Web.xml Editor
- =
- The
- web.xml file inside th=
e
- WEB-INF folder is a d=
eployment descriptor file for a Web Application. It =
- describes the servlets and other components and deployment properties t=
hat make up your application.
- =
- JBoss Tools add the
- web.xml file to create=
d JSF project automatically and provides a special editor for its editing.
- See the Visual Web Tools guide that gives a descriptive information on t=
he web.xml editor.
-
- =
-
-
-
-
- JBoss Developer Studio
- Eclipse
- JSF Tools
- Java
- JBoss
-
-
-
- JSF Configuration File Editor
-
- First, we should mention that JSF configuration file (
- faces-config.xml
- ) is intended for registering JSF application resources=
such as Converters,
- Validators, Managed Beans and page-to-page navigation rules.
- Now, let's look at how you can easily configure this file by mea=
ns of a special
- graphical editor for JSF configuration file. The editor has three =
main views:
-
-
-
- Diagram
-
-
- Tree
-
-
- Source
-
-
-
- They can be selected via the tabs at the bottom of the editor.=
para>
-
-
-
- Diagram view
-
- Here, we will show you how to work with JSF configuration fi=
le through the Diagram
- view of the editor.
- As you can see on the figure below, the Diagram view display=
s the navigation rules in
- the faces-config.xml:
-
- Diagram View
-
-
-
-
-
-
-
- If your diagram is large, make use of the Outline view. With=
in it you can switch to a
- Diagram Navigator
- mode by selecting the middle icon at the top of th=
e view window. It allows
- you to easily move around the diagram. Just move the blue area=
in any direction, and the
- diagram on the left will also move:
-
- Outline View for Diagram
-
-
-
-
-
-
-
- To create a new page here, you should click the page icon (V=
iew Template) on the
- toolbar from the left and then click anywhere on the diagram. =
A New Page Wizard will
- appear.
-
- To create a transition for connecting pages:
-
-
-
- Select the transition icon from the toolbar (New Con=
nection).
-
-
- Click the source page.
-
-
- Click the target page.
-
-
-
- A transition will appear between the two pages:
-
- Transition between JSP Pages
-
-
-
-
-
-
-
- It is also possible to create a new page with context menu b=
y right-clicking anywhere
- on the diagram and selecting
- New View.
-
- Creating a New View
-
-
-
-
-
-
-
- To edit an existing transition, first select the transition =
line. Then, place the
- mouse cursor over the last black dot (on the target page). The=
mouse cursor will change
- to a big +. At this point, drag the line to a new target page:=
-
- Editing Transition between Views
-
-
-
-
-
-
-
-
-
- Tree View
-
- You can find it more convenient to edit your JSF Configurati=
on file in the Tree view of
- the VPE.
-
- The view displays all JSF application artifacts referenced i=
n the configuration file
- in a tree format. By selecting any node on the left, you can s=
ee and edit its properties
- which will appear in the right-hand area. Let's look at the st=
ructure of this
- tree more closely.
-
-
-
- Under the
- Application
- node you can adjust JSF application specif=
ic settings such as
- internationalization, possibility to set extensions, a=
dd property and variable
- resolvers, etc.
-
-
-
-
- JSF Application Specific Settings
-
-
-
-
-
-
-
-
-
- The
- Components
- node is for registering custom JSF compone=
nts. Right-click and
- choose
- New > Component
- or just press the
- Add
- button in the right-hand area to add a new=
component to the JSF
- Configuration file.
-
-
-
-
- Registering a New JSF Component
-
-
-
-
-
-
-
- In the Add Component wiz=
ard you should set a component
- type and point to a component class by using the
- Browse
- button or create a new class for this comp=
onent by using the
- Component-Class
- link.
-
-
- Adding a New JSF Component to the JSF Configuration Fil=
e
-
-
-
-
-
-
-
-
-
- Use the
- Render Kit
- node to create and register a set of relat=
ed renderers for custom
- JSF components.
-
-
-
-
- Adding a New JSF Component to the JSF Configuration Fil=
e
-
-
-
-
-
-
-
-
-
- Under the
- Converters
- node you can create a converter class for =
your JSF application
- either with id or for a proper class. How to do that s=
ee the Create and =
Register a
- Custom Converter section.
-
-
-
-
- Creating a New Custom Converter
-
-
-
-
-
-
-
-
-
- The
- Managed Bean
- node is meant for creating and registering=
Bean classes in your JSF
- application. Read more on the topic in the Managed
- Beans chapter.
-
-
-
-
- Managed Beans
-
-
-
-
-
-
-
-
-
- Use the
- Navigation Rules
- node to configure a navigation between the=
pages in your
- application: create a new navigation rule and adjust n=
ecessary properties for it
- in the right-hand area.
-
-
-
- Tip:
- The same you can do in the Diagram view of the
- JSF Configuration file editor.
-
-
-
- Configuring Navigation Rules
-
-
-
-
-
-
-
-
-
- Under the
- Referenced Beans
- node you can add a new Referenced Bean and=
configure various
- properties for it. To learn more on this refer to the =
Create and Register Referenced Beans
- section.
-
-
-
-
- Referenced Beans
-
-
-
-
-
-
-
-
-
- The
- Validators
- node is needed to create validator classes=
for organizing the
- validation of your application data. You can read more=
on the topic in the Create and Register a Custom
- Validator section.
-
-
-
-
- Validators
-
-
-
-
-
-
-
-
-
- The
- Extensions
- node is for setting extensions for your
- faces-config.xml.
-
-
-
-
- Adding Extensions
-
-
-
-
-
-
-
- In the Tree view you =
can also edit the properties of the selected
- element with the help of the Prope=
rties view as shown below:
-
-
- Properties View
-
-
-
-
-
-
-
-
-
-
- Source View
-
- Here, we'll discuss how you can configure your faces-config.=
xml with the help
- of Source View.
- The Source view for the editor displays a text content of th=
e JSF configuration file.
- It is always synchronized with other two views, so any changes=
made in one of the views
- will immediately appear in the other:
-
- Source View
-
-
-
-
-
-
-
-
- You can also work in the Source view with the help of the
- Outline view. The Outline view shows a tree
- structure of the JSF configuration file. Simply select any ele=
ment in the Outline view,
- and it will jump to the same place in the Source editor, so yo=
u can navigate through the
- source code with Outline view.
-
- Outline View
-
-
-
-
-
-
-
-
-
-
- Editor Features
- Here we'll discuss a very important features that JSF config=
uration file
- editor provides for work with JSF resources.
-
-
- Open On
- The JSF configuration file editor comes with a very usef=
ul OpenOn navigating
- feature. More fully you can read about it in our =
Visual Web Tools
- Guide.
-
-
-
-
- Code Assist
- Code Assist provides pop-up tip to help you complete you=
r code statements. It
- allows you to write your code faster and with more accurac=
y.
- Code assist is always available in the Source mode:
-
- Code Assist in Source View
-
-
-
-
-
-
-
-
-
-
-
- Error Reporting
- When you are developing your project, error checking is =
constantly provided. This
- greatly reduces your development time as it allows you to =
catch many of the errors
- during development.
- Errors will be reported by
- verification facility:
-
- Error Reporting in Source View
-
-
-
-
-
-
-
- Other errors are also reported.
-
- Other Errors Reporting
-
-
-
-
-
-
-
-
-
-
-
-
- =
-
-
-
-
- JBoss Developer Studio
- Eclipse
- JSF Tools
- Java
- JBoss
-
-
-
- Managed Beans
-
- There is lots of power to work with =
managed beans.
-
-
- Add and generate code for new managed beans
-
-
- Generate code for attributes and getter/setter m=
ethods
-
-
-
-
- Add existing managed beans to JSF configuration file
-
-
-
- Thus, in this section we will guides you through all this possib=
ilities.
-
-
-
- Code Generation for Managed Beans
-
- To start, create a new managed bean in JSF configuration fil=
e editor, in the Tree
- view.
-
- Creation of New Managed Bean
-
-
-
-
-
-
-
- Note:
- When you define a new managed bean, make sure that
- Generate Source Code
- is checked as shown in the figure below.
-
-
- New Managed Bean
-
-
-
-
-
-
- After the
- "Java"
- class has been generated you can open it for addit=
ional editing. There are
- two ways to open the
- "Java"
- class:
-
-
-
- click on
- Managed-Bean-Class
- link in the editor
-
-
- or
-
-
- right click the
- managed bean
- and select
- Open Source
-
-
-
-
-
- Opening of Created Managed Bean
-
-
-
-
-
-
-
- The generated Java source should look as follows:
-
-
- Java Source Code
-
-
-
-
-
-
-
- You can also generate source code for properties, also inclu=
des
- "getter"
- and
- "setter"
- methods. Right click on the bean and select
- New > Property
- . You will see Add Prop=
erty dialog.
-
- Generation of Source Code for Properties
-
-
-
-
-
-
- When the form is open make sure that all the check boxes are=
selected:
-
-
- Add Java property
-
-
- Generate Getter
-
-
- Generate Setter
-
-
-
-
- "Add Property" Form
-
-
-
-
-
-
- Once the generation is complete, you can open the file and s=
ee the added property with
-
- "get"
- and
- "set"
- methods:
-
- Generated Java Source Code for Property
-
-
-
-
-
-
- Thus, we've discussed everything which comes to creating a n=
ew Managed Bean.
- The next section will show you how to add an existing Bean int=
o a JSF configuration
- file.
-
-
-
- Add Existing Java Beans to a JSF Configuration File
- If you already have a Java bean you can easily add it to a <=
property moreinfo=3D"none">JSF configuration
- file.
- You should start the same way you create a new managed bean.=
Use the
- Browse...
- button to add your existing Java class.
-
- New Managed Bean Form
-
-
-
-
-
-
- Once the class is set, its
- Name
- will be set as well. But you can easily substitute=
it for the other one.
- Notice that
- Generate Source Code
- option is not available as the
- "Java"
- class already exists.
- After adding your class
- Next
- button will be activated. Pressing it you'll get <=
emphasis>
- Managed Properties
- dialog where all corresponding properties are disp=
layed. Check the necessary
- ones to add them into your JSF Con=
figuration File.
-
-
- Selection of Bean's Properties.
-
-
-
-
-
-
-
- If you don't want to add any, just click
- Finish. =
- Above-listed steps have demonstrated how you can specify an =
existing Bean in the JSF
- configuration file, i.e.
- faces-config.xml. <=
/emphasis> In the next chapter
- you'll know how to organize and register another kind of artif=
acts.
-
-
-
- =
-
-
-
-
- JBoss Developer Studio
- Eclipse
- JSF Tools
- Java
- JBoss
-
-
- Creation and Registration
- =
-
- =
- Create and Register a Custom Converter
- =
- It's also possible to create a
- custom Converter in order to specify your own converting rules=
. Let's look at how you can do this.
- =
- To create and register a custom converter it's necessary=
to
- go through the following steps:
- =
-
-
- In the Project Explorer view open
- faces-config.xml
- and select
- Tree
- tab.
-
-
-
- Converters
-
-
-
-
-
-
-
-
- Select
- Converters
- and click on
- Add
- button.
-
-
- On the form type the name of your converter in the <=
emphasis>
- Converter-id
- field and name of the class for
- converters. After clicking
- Finish
- button your custom converter is
- registered under the entered name.
-
-
-
- Add Converter Form
-
-
-
-
-
-
-
-
- Now you can create
- "converter"
- class. In the Converter section you
- should see your
- Converter-id
- and
- Converter-class<=
/property>.
- Click on
- Converter-class
- to generate the source code.
-
-
-
- Generation of Source Code for Converter Class
-
-
-
-
-
-
- =
-
-
- A usual wizard for creating a Java class will appear.
- All needed fields here will be adjusted
- automatically. Just leave everything without changes
- and click
- Finish.
-
-
-
-
- New Java Class Form
-
-
-
-
-
-
-
-
- To open a converter class click again on
- Converter-class
- link in the Converter section.
-
-
-
- Converter Class
-
-
-
-
-
-
- Now you
- are able to add a business logic of converter in the
- Java editor.
-
- =
-
- =
- Create and Register a Custom Validator
- =
- It's also quite easy to develop your
- own custom Validators. You should perform the actions similar =
to the =
- previous one. Go through the following steps:
-
-
- In the Project Explorer view open
- faces-config.xml
- and select
- Tree
- tab.
-
-
-
- Validator in Faces Config Editor
-
-
-
-
-
-
-
-
- Select
- Validators
- and click on
- Add
- button.
-
-
- Type the name of your validator in the
- Validator-id
- field and name of the class for
- validators. After clicking
- Finish
- button your custom validator is
- registered under the entered name.
-
-
-
- Adding Validator
-
-
-
-
-
-
- =
- Now you can create the "validator" class.
-
-
- In the Validator section you can see your
- Validator-id
- and
- Validator-class=
. To generate the source code click on
- Validator-class.
-
-
-
-
- Creating Validator Class
-
-
-
-
-
-
-
-
- Java class will be created automatically. Leave
- everything without changes and click
- Finish.
-
-
-
-
- New Java Class Form
-
-
-
-
-
-
-
-
- To open validator class click again on
- Validator-Class
- link in the Validator section. Now you
- are able to write a business logic of validator in
- the Java editor.
-
-
-
- Converter Class Editing
-
-
-
-
-
-
-
- =
-
- Create and Register Referenced Beans =
- =
- Creation of Referenced Beans is similar to creation of Custom
- Validator as well. To perform this, let's walk through the nec=
essary steps.
- =
-
-
- In the Project Explorer view open
- faces-config.xml
- and select
- Tree
- tab.
-
-
-
- Referenced Beans in Faces Config Editor
-
-
-
-
-
-
-
-
- Select
- Referenced Beans
- and click on
- Add
- button.
-
-
- Type in the name of your Referenced Bean and type in
- or select
- Referenced-Bean-Class<=
/property>
- by using
- Browse
- button.
-
-
-
- Add Referenced Bean
-
-
-
-
-
-
-
-
- In the Referenced Bean section you should see your <=
emphasis>
- Referenced-Bean-Name
- and
- Referenced-Bean-=
Class.
- Click on the link to open the Java creation
- wizard.
-
-
-
- Create Referenced Bean Class
-
-
-
-
-
-
-
-
- Java class will be created automatically. Leave
- everything without changes and click
- Finish.
-
-
-
-
- New Java Class Form
-
-
-
-
-
-
-
-
- To open Referenced Bean class click again on
- Referenced-Bean-Class
- in the Referenced Bean section. Now you
- are able to write business logic of Referenced Bean
- in the Java editor.
-
-
-
- Referenced Bean Class Editing
-
-
-
-
-
-
-
-
- =
-
-
-
-
-
- JBoss Developer Studio
- Eclipse
- JSF Tools
- Java
- JBoss
-
-
-
- JSF Project Verification
-
- In this chapter we'll discuss a possible verification that you c=
an take advantage
- of.
-
- Many different rules are checked for a JSF project that can be c=
onfigured by selecting
- Window > Preferences
- from the menu bar, selecting
- JBoss Tools > Web > Verifica=
tion
- from the Preferences dialog box and then expanding the=
JSF Rules node.
-
- JSF Rules
-
-
-
-
-
-
- Suppose you are working in the Source viewer for a JSF configura=
tion file as shown below:
-
- Faces-config.xml File
-
-
-
-
-
-
- While typing a class name, you might make a minor typo (like
- "jsfHello.PersonBean9"
- instead of
- "jsfHello.PersonBean"
- ). After saving the file, verification checks to make s=
ure everything is correct
- and finds the error below:
-
- Error in Source View
-
-
-
-
-
-
- Notice that the Package Explorer View shows a marked folder and =
a marked file where the
- error is.
- You can place the cursor over the line with an error message and=
get a detailed error
- message:
-
- Error Message
-
-
-
-
-
-
- Verification also checks navigation rules:
-
- Checking Navigation Rules
-
-
-
-
-
-
- If you provide a page name that does not exist, verification wil=
l let you know about that:
-
- Page Name Verification
-
-
-
-
-
-
- You can always call up verification explicitly by right-clicking=
any element in the tree
- and selecting Verify from the context menu. This works from both t=
he Tree and Diagram
- viewers for the JSF configuration file editor. You can also invoke=
verification from the Web
- Projects view. Below we are checking all of the elements in the co=
nfiguration file.
-
- Verify Command
-
-
-
-
-
-
-
- In summary, this document highlights all the JSF-specific featur=
es of JBoss Tools
- meant for enhancing the development of rich Web applications based=
on JSF technology. The
- reference introduces you to wizards for creating and importing JSF=
projects, JSF
- Configuration File editor features, functionality for enabling JSF=
capabilities and etc.
- =
- If you have questions or good suggestions, please refer to JBoss
- Tools Forum.
-
-
-
+]>
+
+ JSF Tools Reference Guide
+
+
+
+
+ =
+
+
+ =
+ =
+
+ AnatolyFedosik=
author>
+ OlgaChikvina
+ SvetlanaMukhina<=
email>smukhina(a)exadel.com
+ =
+
+ 2007
+ 2008
+ 2009
+ 2010
+ JBoss by Red Hat
+
+
+ Version: 3.1.0.CR2
+
+
+
+
+
+ PDF version
+
+
+
+
+ =
+ =
+ =
+ =
+
+
+
+
+
+ JBoss Developer Studio
+ Eclipse
+ Java
+ JBoss
+ JSF Tools
+
+
+
+ Introduction
+
+ JSF Tools are especially designed for supporting JSF and JSF-rel=
ated technologies. JSF
+ Tools provide extensible and exemplary tools for building JSF-base=
d applications as well as
+ adding JSF capabilities to existing web projects, importing JSF pr=
ojects and choosing any
+ JSF implementation while developing JSF application.
+
+ In this guide we provide you with the information on JSF tooling=
which allows you to
+ develop JSF applications much faster and with far fewer errors so =
sparing your time.
+
+
+ Key Features of JSF Tools
+
+ Here, we provide you with a key functionality which is integ=
rated in JSF tooling.
+
+
+ Key Functionality for JSF Tools
+
+
+
+
+
+
+
+
+ Feature
+ Benefit
+ Chapter
+
+
+
+ =
+
+ JSF and Facelets support
+ Step-by-step wizards for creating new JSF a=
nd Facelets projects with a number of predefined templates, importing exist=
ing ones and adding JSF capabilities to non-jsf web projects.
+ jsf support=
link>
+
+
+
+ Flexible and customizable project template =
management
+ Jump-start development with out-of-the-box =
templates or easily
+ customized templates for re-use.
+
+ projects
+
+
+
+
+ Support for JSF Configuration File
+ Working on file using three modes: diagram,=
tree and source.
+ Synchronization between the modes and full con=
trol over the code. Easy
+ moving around the diagram using the Diagram Na=
vigator.
+
+ graphical ed=
itor for jsf
+
+
+
+
+ Support for Managed Beans
+ Adding new managed beans, generating code f=
or attributes, properties
+ and getter/setter methods.
+
+ managed beans<=
/link>
+
+
+
+
+ Support for Custom Converters and Validator=
s
+ Fast creating of custom converters and vali=
dators with tree view of
+ faces-config.xml file.
+
+ co=
nverters and validators
+
+
+
+
+ Verification and Validation
+ All occuring errors will be immediately rep=
orted by verification
+ feature, no matter in what view you are workin=
g. Constant validation and
+ errors checking allows to catch many of the er=
rors during development
+ process that significantly reduces development=
time.
+
+ ver=
ification and
+ validation
+
+
+
+
+
+
+
+
+ Other relevant resources on the topic
+ All JBoss Developer Studio/JBoss Tools release documentation=
you can find athttp://docs.jbo=
ss.org/tools in the corresponding release directory.
+ The latest documentation builds are available at http://download.jbo=
ss.org/jbosstools/nightly-docs.
+
+
+
+ =
+
+
+
+
+ JBoss Developer Studio
+ Eclipse
+ JSF Tools
+ Java
+ JBoss
+
+
+
+ JavaServer Faces Support
+
+ We don't lock you into any one J=
avaServer
+ Faces implementation. You can always se=
lect the one which is
+ necessary for you while =
creating a new JSF
+ project, addin=
g JSF capability to
+ any existing Eclipse project or importing existing JSF projects as well.<=
/para>
+ At this point the special wizard will prompt you to specify =
a proper JSF environment.
+ It may be JSF 1.1.02 RI or JSF 1.2 which integrates a numb=
er of new features and
+ changes. The wizard also lets you select JSF implementatio=
n with a component
+ orientation such as JSF 1.2 with Facelets or MyFaces 1.1.4=
.
+
+
+ Choosing JSF Environment
+
+
+
+
+
+
+
+ After specifying a proper JSF environment all the required l=
ibraries for the selected
+ version will be added to your project.
+
+
+
+ Facelets Support
+ In this section we will focus more on all concepts t=
hat are integrated for
+ working with Facelets.
+
+ The Facelets extends JavaServer Faces by providing a=
lightweight framework
+ that radically simplifies the design of presentati=
on pages for JSF. Facelets can be used in a variety of ways that we
+ will consider further in this section.
+
+
+ Facelets templates
+ If you want to build an application using Fa=
celets, just create a
+ project with Facelets based on version 1.2=
of the JSF Reference
+ Implementation, i. e. select the
+ JSF 1.=
2 with Facelets
+ in the JSF Environment section=
of the New JSF Project
+ wizard.
+
+
+ Choosing Facelets Environment
+
+
+
+
+
+
+
+ Once you've selected the environment, it's p=
ossible
+ to specify the one of three available temp=
lates:
+
+ Choosing Facelets Template
+
+
+
+
+
+
+ The following table lists possible templates=
with Facelets for any JSF
+ project and gives a proper description for=
each one.
+
+ Facelets Templates
+
+
+
+
+
+
+
+
+ Template
+
+
+
+ Description
+
+
+
+
+
+
+
+
+
+
+ FaceletsBlankWithoutLibs
+
+
+
+
+
+ Some servers alrea=
dy provide
+ jsf libs and you take ri=
sk
+ of getting conflicting
+ libraries while deploying
+ your project. To avoid s=
uch
+ conflicts, use a template
+ without libs if you have=
a
+ server with its own jsf
+ libraries
+
+
+
+
+
+
+
+ FaceletsKickStartWithRILibs
+
+
+
+
+
+ A sample applicati=
on with
+ Facelets that is ready to
+ run
+
+
+
+
+
+
+
+ FaceletsKickStartWithoutLibs
+
+
+
+
+
+ A sample applicati=
on without
+ libraries
+
+
+
+
+
+
+
+
+ Facelets components
+
+ The JBoss Tools
+ Palette comes with the Fac=
elets components ready to
+ use. A useful tip appears when you hover t=
he mouse cursor over the
+ tag, the tip includes a detailed descripti=
on of the tag component,
+ the syntax and available attributes.
+
+
+
+ Facelets Components
+
+
+
+
+
+
+
+
+ Code assist for Facelets
+
+ One more feature which comes with Facelets s=
upport is code assist
+ (Ctrl + Space). It is available for Facelets
+ tags while editing
+ .xhtml=
+ files.
+
+
+ XHTML File Code Assist
+
+
+
+
+
+
+
+ What's more, code assist is also available f=
or
+ "jsfc"=
+ attribute in any HTML tag.
+
+
+ Code Assist for JSFC Attribute
+
+
+
+
+
+
+
+ After selecting
+ "jsfc"=
+ you get the code assist for JS=
F components available on
+ a page.
+
+
+ Code Assist for JSF Components
+
+
+
+
+
+
+
+ When a component is chosen you will see all =
available attributes for
+ it.
+
+
+ Available Attributes for the Compon=
ent
+
+
+
+
+
+
+
+
+ Open On feature
+ Finally, Eclipse's
+ OpenOn=
+ feature for editing Facelets f=
iles is supported. Using this feature,
+ you can easily navigate between the Facelets
+ templates and other parts of yo=
ur projects. Just by
+ holding down the Control key while hoverin=
g the mouse cursor over a
+ reference to a template, the reference bec=
omes a hyperlink to open
+ that template.
+
+
+
+ Template Hyperlink
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =
+
+
+
+
+ JBoss Developer Studio
+ Eclipse
+ JSF Tools
+ Java
+ JBoss
+
+
+
+ Projects
+ To take an advantage of JSF firstly you should perform one o=
f the next steps:
+
+
+
+ Create new JSF projects
+
+
+ Import (open) existing JSF projects
+
+
+ Add JSF capability to any existing Eclipse p=
roject
+
+
+ Import and add JSF capability to any existin=
g project created outside
+ Eclipse.
+
+
+ In this section we're going to stop on each of them in detai=
l.
+
+
+
+ Creating a New JSF Project
+
+ If you want your project to already contain all JSF =
libraries, tag libraries
+ and JSF configuration file, just organize a new br=
and JSF project. It is
+ possible to do this easily with the help of the sp=
ecial wizard. To get it, select
+ File > New=
> Project > JBoos Tools
+ Web > JSF > JSF Project
+ and click
+ Next.
+
+
+ Choosing a JSF Project
+
+
+
+
+
+
+
+ On the next form you'll be prompted to enter Project
+ Name and select a location for =
the project or just leave
+ a default path.
+ Here, JSF Version also allows you to select which JS=
F implementation to
+ use.
+
+ Creating a New JSF Project
+
+
+
+
+
+
+
+ There is a number of predefined project templates th=
at are flexible and easily
+ customizable. Thus you can pick a different templa=
te on which the projects
+ Importing Existing should be based on. Almost all =
templates come in two
+ variations: with jsf libraries and without ones.=
para>
+
+ Choosing JSF Templates
+
+
+
+
+
+
+
+ The table below provides description for each possib=
le JSF template.
+
+ JSF Project Templates
+
+
+
+
+
+
+
+
+ Template
+
+
+
+ Description
+
+
+
+
+
+
+
+
+
+
+ JSFBlankWithLibs
+
+
+
+
+
+ This template will=
create a standard Web
+ project structure with a=
ll JSF capabilities
+
+
+
+
+
+
+
+ JSFKickStartWithLibs
+
+
+
+
+
+ This template will=
create a standard Web
+ project structure but wi=
ll also include a sample
+ application that is read=
y to run
+
+
+
+
+
+
+
+ JSFKickStartWithoutLibs
+
+
+
+
+
+ Some servers alrea=
dy provide jsf libs and
+ you take risk of getting=
conflicting libraries
+ while deploying your pro=
ject. To avoid such
+ conflicts, use a templat=
e without libs if you have
+ a server with its own js=
f libraries
+
+
+
+
+
+
+
+
+
+
+ On the next screen select what
+ Servlet versio=
n
+ to use and whether to register this ap=
plication with JBoss AS
+ (or other server) for running and testing your app=
lication.
+
+ The
+ Context Path=
property>
+ is the name under which the applicatio=
n will be deployed.
+
+ The
+ Runtime
+ value tells Eclipse where to find Web =
libraries in order to
+ build (compile) the project. It is not possible to=
finish project creation
+ without selecting Runtime. If you don't have any v=
alues, select
+ New...
+ to add new Runtime.
+
+ The
+ Target Server<=
/property>
+ allows you specifying whether to deplo=
y the application. The
+ Target Server corresponds to the Runtime value sel=
ected above. If you
+ don't want to deploy the application, uncheck this=
value.
+
+ Registering the Project on Server
+
+
+
+
+
+
+
+ When you are all done, you should have the project t=
hat has been appeared in
+ the Package Explorer view:
+
+ A New Project in the Package Explorer
+
+
+
+
+
+
+
+ At this point you can open
+ faces-config.x=
ml
+ and start working on your application.=
There are a lot of
+ features to develop JSF applications. We will desc=
ribe the features
+ further.
+
+
+
+
+ Importing Existing JSF Projects with Any Structure<=
/title>
+
+ For detailed information on migration of JSF project=
s into a workspace see
+ Migration
+ Guide.
+
+
+
+
+ Adding JSF Capability to Any Existing Eclipse Proje=
ct
+
+ It's also possible to add JSF capability (JSF
+ libraries, tag libraries) to any existing Eclipse =
project in your workspace.
+ After that you'll be able to make use of such edit=
ors as JSF
+ configuration editor, JBoss Tools JSP editor and a=
ny others.
+ Right click the project and select
+ JBoss Tools &g=
t; Add JSF Capabilities.
+ This will start the process of adding all necessar=
y libraries, files to make
+ this a Web JSF project.
+
+ Adding JSF Capabilities
+
+
+
+
+
+
+ The wizard will first ask you to show the
+ web.xml
+ file location and the project name.
+
+ Project Location
+
+
+
+
+
+
+ On the last form you can set the different folders f=
or your project as well as
+ register this application with a servlet container=
.
+
+ Make sure to select
+ Add Libraries<=
/property>
+ to add all required JSF related librar=
ies to this
+ project.
+
+ The
+ Context Path=
property>
+ is the name under which the applicatio=
n will be deployed.
+
+ The
+ Runtime
+ value tells Eclipse where to find Web =
libraries in order to
+ build (compile) the project. It is not possible to=
finish project import
+ without selecting Runtime. If you don't have any v=
alues, select
+ New...
+ to add new Runtime.
+
+ The
+ Target Server<=
/property>
+ allows you to specify whether to deplo=
y the application. The
+ Target Server corresponds to the Runtime value sel=
ected above. If you
+ don't want to deploy the application, uncheck this=
value.
+
+ Project Folders
+
+
+
+
+
+
+ Once your project is imported you can see that JSF r=
elated libraries have been
+ added to your project:
+ jsf-api.jar
+ and
+ jsf-impl.jar=
property>
+ .
+
+ Note:
+ Some application servers provide their own j=
sf implementation
+ libraries. Thus, to avoid conflicts you sh=
ould not add jsf libraries
+ while adding jsf capabilities.
+
+ You are now ready to work with JSF by creating a new=
JSF configuration
+ file:
+
+
+
+ Creating a New JSF Configuration File
+
+
+
+
+
+
+
+ Once the file has been created, it should be opened =
in a special Faces Config Editor.<=
/para>
+
+
+
+ Adding Your Own Project Templates
+ Template is a set of files that is served as a basis=
to facilitate the
+ creation of a new project. Project templates provi=
de content and structure
+ for a project.
+ There is a powerful templating capability for creati=
ng new and importing
+ existing Struts and JSF projects. This templating =
facility has a variety of
+ aspects to consider. But, let's start with the mos=
t straightforward
+ case and consider the process of creating a templa=
te from your existing JSF
+ project.
+
+ Let's say you have a project that you want to use as=
the basis for a
+ new template. Follow these steps to make a template out
+ of it:
+
+
+ In the Web Projects view, right-clic=
k the project and select
+ JBoss Tools JSF > Save As
+ Template
+
+
+
+
+ Saving Your Project as Template
+
+
+
+
+
+
+
+
+ In the first dialog box, you can cho=
ose a name for the
+ template (defaults to the project =
name) and confirm what
+ run-time implementation of the pro=
ject technology will be
+ used
+
+
+
+
+ Define Template Properties
+
+
+
+
+
+
+
+
+
+
+ Select
+ Next
+ and you will be sent t=
o a dialog box with your
+ project structure displayed with c=
heck boxes. Here you can
+ check only those parts and files i=
n your project directory
+ that should be part of the templat=
e
+
+
+
+ Define Template Properties
+
+
+
+
+
+
+
+
+ At this point, unless you want to de=
signate some extra files
+ as having Velocity template coding=
inside them, you should
+ click
+ Finish
+ .
+
+
+ That's it. Now, you can use this template with any n=
ew or imported
+ project that uses the same run-time implementation=
as the project you turned
+ into a template.
+ At this point, you have a fully configured project a=
nd now you can bring some
+ new logic to it starting from JSF configuration fi=
le.
+
+
+ Relevant Resources Links
+
+ You can find more in-depth explanation on how to wor=
k with special wizards, editors and views that can
+ be used in various scenarios while developing JSF =
applications in our Visual =
Web Tools guide.
+
+
+
+ =
+
+
+
+
+ JBoss Tools
+ JSF Tools
+
+
+ =
+ Web.xml Editor
+ =
+ The
+ web.xml file inside th=
e
+ WEB-INF folder is a d=
eployment descriptor file for a Web Application. It =
+ describes the servlets and other components and deployment properties t=
hat make up your application.
+ =
+ JBoss Tools add the
+ web.xml file to create=
d JSF project automatically and provides a special editor for its editing.
+ See the Visual Web Tools guide that gives a descriptive information on t=
he web.xml editor.
+
+ =
+
+
+
+
+ JBoss Developer Studio
+ Eclipse
+ JSF Tools
+ Java
+ JBoss
+
+
+
+ JSF Configuration File Editor
+
+ First, we should mention that JSF configuration file (
+ faces-config.xml
+ ) is intended for registering JSF application resources=
such as Converters,
+ Validators, Managed Beans and page-to-page navigation rules.
+ Now, let's look at how you can easily configure this file by mea=
ns of a special
+ graphical editor for JSF configuration file. The editor has three =
main views:
+
+
+
+ Diagram
+
+
+ Tree
+
+
+ Source
+
+
+
+ They can be selected via the tabs at the bottom of the editor.=
para>
+
+
+
+ Diagram view
+
+ Here, we will show you how to work with JSF configuration fi=
le through the Diagram
+ view of the editor.
+ As you can see on the figure below, the Diagram view display=
s the navigation rules in
+ the faces-config.xml:
+
+ Diagram View
+
+
+
+
+
+
+
+ If your diagram is large, make use of the Outline view. With=
in it you can switch to a
+ Diagram Navigator
+ mode by selecting the middle icon at the top of th=
e view window. It allows
+ you to easily move around the diagram. Just move the blue area=
in any direction, and the
+ diagram on the left will also move:
+
+ Outline View for Diagram
+
+
+
+
+
+
+
+ To create a new page here, you should click the page icon (V=
iew Template) on the
+ toolbar from the left and then click anywhere on the diagram. =
A New Page Wizard will
+ appear.
+
+ To create a transition for connecting pages:
+
+
+
+ Select the transition icon from the toolbar (New Con=
nection).
+
+
+ Click the source page.
+
+
+ Click the target page.
+
+
+
+ A transition will appear between the two pages:
+
+ Transition between JSP Pages
+
+
+
+
+
+
+
+ It is also possible to create a new page with context menu b=
y right-clicking anywhere
+ on the diagram and selecting
+ New View.
+
+ Creating a New View
+
+
+
+
+
+
+
+ To edit an existing transition, first select the transition =
line. Then, place the
+ mouse cursor over the last black dot (on the target page). The=
mouse cursor will change
+ to a big +. At this point, drag the line to a new target page:=
+
+ Editing Transition between Views
+
+
+
+
+
+
+
+
+
+ Tree View
+
+ You can find it more convenient to edit your JSF Configurati=
on file in the Tree view of
+ the VPE.
+
+ The view displays all JSF application artifacts referenced i=
n the configuration file
+ in a tree format. By selecting any node on the left, you can s=
ee and edit its properties
+ which will appear in the right-hand area. Let's look at the st=
ructure of this
+ tree more closely.
+
+
+
+ Under the
+ Application
+ node you can adjust JSF application specif=
ic settings such as
+ internationalization, possibility to set extensions, a=
dd property and variable
+ resolvers, etc.
+
+
+
+
+ JSF Application Specific Settings
+
+
+
+
+
+
+
+
+
+ The
+ Components
+ node is for registering custom JSF compone=
nts. Right-click and
+ choose
+ New > Component
+ or just press the
+ Add
+ button in the right-hand area to add a new=
component to the JSF
+ Configuration file.
+
+
+
+
+ Registering a New JSF Component
+
+
+
+
+
+
+
+ In the Add Component wiz=
ard you should set a component
+ type and point to a component class by using the
+ Browse
+ button or create a new class for this comp=
onent by using the
+ Component-Class
+ link.
+
+
+ Adding a New JSF Component to the JSF Configuration Fil=
e
+
+
+
+
+
+
+
+
+
+ Use the
+ Render Kit
+ node to create and register a set of relat=
ed renderers for custom
+ JSF components.
+
+
+
+
+ Adding a New JSF Component to the JSF Configuration Fil=
e
+
+
+
+
+
+
+
+
+
+ Under the
+ Converters
+ node you can create a converter class for =
your JSF application
+ either with id or for a proper class. How to do that s=
ee the Create and =
Register a
+ Custom Converter section.
+
+
+
+
+ Creating a New Custom Converter
+
+
+
+
+
+
+
+
+
+ The
+ Managed Bean
+ node is meant for creating and registering=
Bean classes in your JSF
+ application. Read more on the topic in the Managed
+ Beans chapter.
+
+
+
+
+ Managed Beans
+
+
+
+
+
+
+
+
+
+ Use the
+ Navigation Rules
+ node to configure a navigation between the=
pages in your
+ application: create a new navigation rule and adjust n=
ecessary properties for it
+ in the right-hand area.
+
+
+
+ Tip:
+ The same you can do in the Diagram view of the
+ JSF Configuration file editor.
+
+
+
+ Configuring Navigation Rules
+
+
+
+
+
+
+
+
+
+ Under the
+ Referenced Beans
+ node you can add a new Referenced Bean and=
configure various
+ properties for it. To learn more on this refer to the =
Create and Register Referenced Beans
+ section.
+
+
+
+
+ Referenced Beans
+
+
+
+
+
+
+
+
+
+ The
+ Validators
+ node is needed to create validator classes=
for organizing the
+ validation of your application data. You can read more=
on the topic in the Create and Register a Custom
+ Validator section.
+
+
+
+
+ Validators
+
+
+
+
+
+
+
+
+
+ The
+ Extensions
+ node is for setting extensions for your
+ faces-config.xml.
+
+
+
+
+ Adding Extensions
+
+
+
+
+
+
+
+ In the Tree view you =
can also edit the properties of the selected
+ element with the help of the Prope=
rties view as shown below:
+
+
+ Properties View
+
+
+
+
+
+
+
+
+
+
+ Source View
+
+ Here, we'll discuss how you can configure your faces-config.=
xml with the help
+ of Source View.
+ The Source view for the editor displays a text content of th=
e JSF configuration file.
+ It is always synchronized with other two views, so any changes=
made in one of the views
+ will immediately appear in the other:
+
+ Source View
+
+
+
+
+
+
+
+
+ You can also work in the Source view with the help of the
+ Outline view. The Outline view shows a tree
+ structure of the JSF configuration file. Simply select any ele=
ment in the Outline view,
+ and it will jump to the same place in the Source editor, so yo=
u can navigate through the
+ source code with Outline view.
+
+ Outline View
+
+
+
+
+
+
+
+
+
+
+ Editor Features
+ Here we'll discuss a very important features that JSF config=
uration file
+ editor provides for work with JSF resources.
+
+
+ Open On
+ The JSF configuration file editor comes with a very usef=
ul OpenOn navigating
+ feature. More fully you can read about it in our =
Visual Web Tools
+ Guide.
+
+
+
+
+ Code Assist
+ Code Assist provides pop-up tip to help you complete you=
r code statements. It
+ allows you to write your code faster and with more accurac=
y.
+ Code assist is always available in the Source mode:
+
+ Code Assist in Source View
+
+
+
+
+
+
+
+
+
+
+
+ Error Reporting
+ When you are developing your project, error checking is =
constantly provided. This
+ greatly reduces your development time as it allows you to =
catch many of the errors
+ during development.
+ Errors will be reported by
+ verification facility:
+
+ Error Reporting in Source View
+
+
+
+
+
+
+
+ Other errors are also reported.
+
+ Other Errors Reporting
+
+
+
+
+
+
+
+
+
+
+
+
+ =
+
+
+
+
+ JBoss Developer Studio
+ Eclipse
+ JSF Tools
+ Java
+ JBoss
+
+
+
+ Managed Beans
+
+ There is lots of power to work with =
managed beans.
+
+
+ Add and generate code for new managed beans
+
+
+ Generate code for attributes and getter/setter m=
ethods
+
+
+
+
+ Add existing managed beans to JSF configuration file
+
+
+
+ Thus, in this section we will guides you through all this possib=
ilities.
+
+
+
+ Code Generation for Managed Beans
+
+ To start, create a new managed bean in JSF configuration fil=
e editor, in the Tree
+ view.
+
+ Creation of New Managed Bean
+
+
+
+
+
+
+
+ Note:
+ When you define a new managed bean, make sure that
+ Generate Source Code
+ is checked as shown in the figure below.
+
+
+ New Managed Bean
+
+
+
+
+
+
+ After the
+ "Java"
+ class has been generated you can open it for addit=
ional editing. There are
+ two ways to open the
+ "Java"
+ class:
+
+
+
+ click on
+ Managed-Bean-Class
+ link in the editor
+
+
+ or
+
+
+ right click the
+ managed bean
+ and select
+ Open Source
+
+
+
+
+
+ Opening of Created Managed Bean
+
+
+
+
+
+
+
+ The generated Java source should look as follows:
+
+
+ Java Source Code
+
+
+
+
+
+
+
+ You can also generate source code for properties, also inclu=
des
+ "getter"
+ and
+ "setter"
+ methods. Right click on the bean and select
+ New > Property
+ . You will see Add Prop=
erty dialog.
+
+ Generation of Source Code for Properties
+
+
+
+
+
+
+ When the form is open make sure that all the check boxes are=
selected:
+
+
+ Add Java property
+
+
+ Generate Getter
+
+
+ Generate Setter
+
+
+
+
+ "Add Property" Form
+
+
+
+
+
+
+ Once the generation is complete, you can open the file and s=
ee the added property with
+
+ "get"
+ and
+ "set"
+ methods:
+
+ Generated Java Source Code for Property
+
+
+
+
+
+
+ Thus, we've discussed everything which comes to creating a n=
ew Managed Bean.
+ The next section will show you how to add an existing Bean int=
o a JSF configuration
+ file.
+
+
+
+ Add Existing Java Beans to a JSF Configuration File
+ If you already have a Java bean you can easily add it to a <=
property moreinfo=3D"none">JSF configuration
+ file.
+ You should start the same way you create a new managed bean.=
Use the
+ Browse...
+ button to add your existing Java class.
+
+ New Managed Bean Form
+
+
+
+
+
+
+ Once the class is set, its
+ Name
+ will be set as well. But you can easily substitute=
it for the other one.
+ Notice that
+ Generate Source Code
+ option is not available as the
+ "Java"
+ class already exists.
+ After adding your class
+ Next
+ button will be activated. Pressing it you'll get <=
emphasis>
+ Managed Properties
+ dialog where all corresponding properties are disp=
layed. Check the necessary
+ ones to add them into your JSF Con=
figuration File.
+
+
+ Selection of Bean's Properties.
+
+
+
+
+
+
+
+ If you don't want to add any, just click
+ Finish. =
+ Above-listed steps have demonstrated how you can specify an =
existing Bean in the JSF
+ configuration file, i.e.
+ faces-config.xml. <=
/emphasis> In the next chapter
+ you'll know how to organize and register another kind of artif=
acts.
+
+
+
+ =
+
+
+
+
+ JBoss Developer Studio
+ Eclipse
+ JSF Tools
+ Java
+ JBoss
+
+
+ Creation and Registration
+ =
+
+ =
+ Create and Register a Custom Converter
+ =
+ It's also possible to create a
+ custom Converter in order to specify your own converting rules=
. Let's look at how you can do this.
+ =
+ To create and register a custom converter it's necessary=
to
+ go through the following steps:
+ =
+
+
+ In the Project Explorer view open
+ faces-config.xml
+ and select
+ Tree
+ tab.
+
+
+
+ Converters
+
+
+
+
+
+
+
+
+ Select
+ Converters
+ and click on
+ Add
+ button.
+
+
+ On the form type the name of your converter in the <=
emphasis>
+ Converter-id
+ field and name of the class for
+ converters. After clicking
+ Finish
+ button your custom converter is
+ registered under the entered name.
+
+
+
+ Add Converter Form
+
+
+
+
+
+
+
+
+ Now you can create
+ "converter"
+ class. In the Converter section you
+ should see your
+ Converter-id
+ and
+ Converter-class<=
/property>.
+ Click on
+ Converter-class
+ to generate the source code.
+
+
+
+ Generation of Source Code for Converter Class
+
+
+
+
+
+
+ =
+
+
+ A usual wizard for creating a Java class will appear.
+ All needed fields here will be adjusted
+ automatically. Just leave everything without changes
+ and click
+ Finish.
+
+
+
+
+ New Java Class Form
+
+
+
+
+
+
+
+
+ To open a converter class click again on
+ Converter-class
+ link in the Converter section.
+
+
+
+ Converter Class
+
+
+
+
+
+
+ Now you
+ are able to add a business logic of converter in the
+ Java editor.
+
+ =
+
+ =
+ Create and Register a Custom Validator
+ =
+ It's also quite easy to develop your
+ own custom Validators. You should perform the actions similar =
to the =
+ previous one. Go through the following steps:
+
+
+ In the Project Explorer view open
+ faces-config.xml
+ and select
+ Tree
+ tab.
+
+
+
+ Validator in Faces Config Editor
+
+
+
+
+
+
+
+
+ Select
+ Validators
+ and click on
+ Add
+ button.
+
+
+ Type the name of your validator in the
+ Validator-id
+ field and name of the class for
+ validators. After clicking
+ Finish
+ button your custom validator is
+ registered under the entered name.
+
+
+
+ Adding Validator
+
+
+
+
+
+
+ =
+ Now you can create the "validator" class.
+
+
+ In the Validator section you can see your
+ Validator-id
+ and
+ Validator-class=
. To generate the source code click on
+ Validator-class.
+
+
+
+
+ Creating Validator Class
+
+
+
+
+
+
+
+
+ Java class will be created automatically. Leave
+ everything without changes and click
+ Finish.
+
+
+
+
+ New Java Class Form
+
+
+
+
+
+
+
+
+ To open validator class click again on
+ Validator-Class
+ link in the Validator section. Now you
+ are able to write a business logic of validator in
+ the Java editor.
+
+
+
+ Converter Class Editing
+
+
+
+
+
+
+
+ =
+
+ Create and Register Referenced Beans =
+ =
+ Creation of Referenced Beans is similar to creation of Custom
+ Validator as well. To perform this, let's walk through the nec=
essary steps.
+ =
+
+
+ In the Project Explorer view open
+ faces-config.xml
+ and select
+ Tree
+ tab.
+
+
+
+ Referenced Beans in Faces Config Editor
+
+
+
+
+
+
+
+
+ Select
+ Referenced Beans
+ and click on
+ Add
+ button.
+
+
+ Type in the name of your Referenced Bean and type in
+ or select
+ Referenced-Bean-Class<=
/property>
+ by using
+ Browse
+ button.
+
+
+
+ Add Referenced Bean
+
+
+
+
+
+
+
+
+ In the Referenced Bean section you should see your <=
emphasis>
+ Referenced-Bean-Name
+ and
+ Referenced-Bean-=
Class.
+ Click on the link to open the Java creation
+ wizard.
+
+
+
+ Create Referenced Bean Class
+
+
+
+
+
+
+
+
+ Java class will be created automatically. Leave
+ everything without changes and click
+ Finish.
+
+
+
+
+ New Java Class Form
+
+
+
+
+
+
+
+
+ To open Referenced Bean class click again on
+ Referenced-Bean-Class
+ in the Referenced Bean section. Now you
+ are able to write business logic of Referenced Bean
+ in the Java editor.
+
+
+
+ Referenced Bean Class Editing
+
+
+
+
+
+
+
+
+ =
+
+
+
+
+
+ JBoss Developer Studio
+ Eclipse
+ JSF Tools
+ Java
+ JBoss
+
+
+
+ JSF Project Verification
+
+ In this chapter we'll discuss a possible verification that you c=
an take advantage
+ of.
+
+ Many different rules are checked for a JSF project that can be c=
onfigured by selecting
+ Window > Preferences
+ from the menu bar, selecting
+ JBoss Tools > Web > Verifica=
tion
+ from the Preferences dialog box and then expanding the=
JSF Rules node.
+
+ JSF Rules
+
+
+
+
+
+
+ Suppose you are working in the Source viewer for a JSF configura=
tion file as shown below:
+
+ Faces-config.xml File
+
+
+
+
+
+
+ While typing a class name, you might make a minor typo (like
+ "jsfHello.PersonBean9"
+ instead of
+ "jsfHello.PersonBean"
+ ). After saving the file, verification checks to make s=
ure everything is correct
+ and finds the error below:
+
+ Error in Source View
+
+
+
+
+
+
+ Notice that the Package Explorer View shows a marked folder and =
a marked file where the
+ error is.
+ You can place the cursor over the line with an error message and=
get a detailed error
+ message:
+
+ Error Message
+
+
+
+
+
+
+ Verification also checks navigation rules:
+
+ Checking Navigation Rules
+
+
+
+
+
+
+ If you provide a page name that does not exist, verification wil=
l let you know about that:
+
+ Page Name Verification
+
+
+
+
+
+
+ You can always call up verification explicitly by right-clicking=
any element in the tree
+ and selecting Verify from the context menu. This works from both t=
he Tree and Diagram
+ viewers for the JSF configuration file editor. You can also invoke=
verification from the Web
+ Projects view. Below we are checking all of the elements in the co=
nfiguration file.
+
+ Verify Command
+
+
+
+
+
+
+
+ In summary, this document highlights all the JSF-specific featur=
es of JBoss Tools
+ meant for enhancing the development of rich Web applications based=
on JSF technology. The
+ reference introduces you to wizards for creating and importing JSF=
projects, JSF
+ Configuration File editor features, functionality for enabling JSF=
capabilities and etc.
+ =
+ If you have questions or good suggestions, please refer to =
+ JBoss
+ Tools Forum.
+
+
+
--===============4312792368139628346==--