Академический Документы
Профессиональный Документы
Культура Документы
Intended Readers
This manual is intended for application designers and those who implement applications.
Readers are assumed to have knowledge of the following:
· Creating applications using servlets and JSPs
Related Manuals
Read also the following manuals as necessary:
JavaServer Faces API Reference
For details on JavaServer Faces Java classes and Java interfaces, refer to this manual.
JavaServer Faces Definition File Reference
For details on coding of the JavaServer Faces definition file (faces-config.xml), refer to this manual.
JavaServer Faces Tag Reference
For details of the standard tags provided by JavaServer Faces, refer to this manual.
Apcoordinator User's Guide
For details on each function of Apcoordinator, refer to this manual.
UJI Tag Reference
For details of UJI tags, refer to this manual.
i
ii
Contents
Chapter 1 Overview of JavaServer Faces ................................................................ 1
1.1 JavaServer Faces ....................................................................................................................... 1
iii
7.2 Files Required for Execution ..................................................................................................... 48
7.3 Web Application Environment Definition File (web.xml)............................................................ 48
Terms .................................................................................................................... 61
iv
Chapter 1 Overview of JavaServer Faces
1.1 JavaServer Faces
JavaServer Faces is a set of specifications drawn up as JSR-127 by the Java Community Process (JCP). It is an
application framework for creating Web application user interfaces.
JavaServer Faces has the following features:
· User interfaces (UIs) developed with JavaServer Faces in a development environment can be used to
develop Web applications through a GUI.
· JavaServer Faces supports an "event model" that implements processing on a server at the time that an
event that occurred on a client is received.
· Original UIs can be developed using the JavaServer Faces framework.
The figure below shows an outline of an application using JavaServer Faces.
As shown in the above figure, a JavaServer Faces application consists of the following components:
JSP
A JSP page can use Apcoordinator UJI tags and JavaServer Faces tags. It defines event
processing for buttons on the page and for changes in input data. For each event, the
JavaServer Faces runtime engine invokes the corresponding event listener or Java class
method.
Managed bean
Bean for storing page values
faces-config.xml
File with definitions of the JavaServer Faces environment. The environment that is
defined includes page transitions, events to be invoked, and beans to be used.
1
2
Chapter 2 JavaServer Faces Functions
2.1 JavaServer Faces Applications and Lifecycle
As with general Java Web applications, JavaServer Faces applications run on servlet containers by using JSP,
Java Beans, and event listeners.
One of the unique functions of JavaServer Faces is the capability to use built-in and user-created UIComponents,
event handlers, validators, and converters defined in an external environment definition file (faces-config.xml).
This enables UI and event processing logic to be corrected separately, thereby improving productivity in fixing
and adding new functions to an application.
The lifecycle of a JavaServer Faces application is explained below. The lifecycle means the processing flow from
the time that the JavaServer Faces application receives a request until it returns a response.
JavaServer Faces processes a request in the following processing flow:
The six phases indicated by solid arrows are processed sequentially unless a validation or conversion error
occurs or event processing occurs. The dotted lines indicate error processing.
3
updating of the model fails, an error message is set in the FacesContext instance, and the phase changes to the
Render Response phase.
This product provides a tag library called UJI tags in addition to the standard tags provided by
JavaServer Faces. For details on UJI tags, refer to "Development Using UJI Tags".
A coding example of an input-output page is shown below.As indicated by comments, the example assigns a value,
specifies a validator, and specifies event processing.
<HTML>
<HEAD> <TITLE>Sample1</TITLE> </HEAD>
<!-- Declares use of the JavaServer Faces tag library. -->
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<BODY>
<!-- Writes JavaServer Faces UIComponent tags in f:view. -->
<f:view>
<H2>Sample</H2>
<h:form>
<!-- Assigns a value to the myBean userId property. -->
<h:inputText value="#{myBean.userId}" >
<!-- Specifies the maximum number of characters with a
validator. -->
<f:validateLength maximum="10"/>
</h:inputText>
<!-- Invokes the myBean doAnyAction method when the button is
clicked. -->
4
<h:commandButton action="#{myBean.doAnyAction}" value="GO"/>
</h:form>
</f:view>
</BODY>
</HTML>
The UIComponents in the above coding are converted into HTML by the renderer prepared in advance, and the
resulting display is as shown below.
UIComponents and renderers used to display UIComponents are designed separately in JavaServer
Faces.Accordingly, simply changing renderers enables UIComponents to be displayed in different
modes.Renderers are created so that they display UIComponents in the appropriate formats for individual
clients.In JavaServer Faces, Renderers that display UIComponent in HTML are prepared in advance.
For details on how to create input-output pages, refer to "Creating an Input-Output Page".
<!-- Specify a property for value and a method for validator. -->
<h:inputText id="empNo"
value="#{EmployeeBean.userNumber}"
validator="#{EmployeeBean.validateNumber}" />
5
Value binding expression
Write a managed bean identifier and property name by concatenating them with "." (dot) in "#{ }".
If beans are nested, as many beans as the number of nested beans can be concatenated using "."
A sample JSP page is shown below.
<f:view>
<!-- Displaying the myprop property of the managed bean, which
is defined with the name mybean -->
<h:outputText value="#{mybean.myprop}" />
If the property is an array, java.util.List, java.util.Map, refer to the value by using "[]".
<f:view>
<!-- If the myArray property is an array, display the 0th element
of the array. -->
<h:outputText value="#{mybean.myArray[0]}" />
<f:view>
<h:form>
<!-- Use the validate method of the managed bean defined with
the name mybean to verify the value. -->
<h:inputText value="#{mybean.myprop}"
validator="#{mybean.validate}" />
</h:form>
</f:view>
6
Reserved variables
The following reserved variables can be used in value binding expressions and method binding expressions.
Variable name Type Explanation
applicationScop Collection of all application scope
java.util.Map
e variables
Collection of cookies in a request.
The Map key is a cookie name, and
cookie java.util.Map the value is the
javax.servlet.http.Cookie
instance.
javax.faces.context.FacesConte javax.faces.context.FacesCon
facesContext
xt text class instance
Collection of all request headers.
header java.util.Map Individual values in Map are of the
java.lang.String type.
Collection of all request headers.
headerValues java.util.Map Individual values are arrays of the
java.lang.String type.
Collection of application
initParam java.util.Map
initialization parameters
Collection of request parameters.
The value of the first request
param java.util.Map
parameter of those corresponding to
individual keys is stored.
Collection of request parameters.
The request parameter
paramValues java.util.Map
corresponding to each key is stored
in the java.lang.String array.
Collection of all request scope
requestScope java.util.Map
variables
Collection of all session scope
sessionScope java.util.Map
variables
javax.faces.component.UIView
javax.faces.component.UIViewRo
view Root class instance corresponding to
ot
the page being displayed
An example of use of a reserved variable is shown below.
<f:view>
<!-- Display for the request parameter corresponding to key
"paramKey" -->
<h:outputText value="#{param['paramKey']}" />
</f:view>
7
JavaServer Faces supports the following three types of events:
· ActionEvent occurs at such times as when the user clicks a button or hyperlink component.This event
occurs in the Invoke Application or Apply Request Values phase.
· ValueChangeEvent occurs when the user changes the value of a UIComponent. This event does not
occur at the time that a validation error is detected.This event occurs in the Process Validations or Apply
Request Values phase.
· PhaseEvent can perform processing by causing an interrupt before or after a JavaServer Faces lifecycle
phase.This event can be used for unified preprocessing and postprocessing of a business logic.
Applications can process these events as follows:
· The application creates an event listener and assigns it to a UIComponent by using the
f:valueChangeListener tag or f:actionListener tag on an input-output page.In the case of the
PhaseEvent listener, the application defines it in the JavaServer Faces definition file (faces-config.xml).
· The application uses the managed bean method to create event processing and specifies the
method-binding expression in the appropriate attribute of a UIComponent.
For details on how to create and invoke individual events, refer to "Creating an Event Listener".
<faces-config>
...
<navigation-rule>
<!-- Write the transition source JSP name. -->
<from-view-id>/input.jsp</from-view-id>
<navigation-case>
<from-outcome>fail</from-outcome>
<to-view-id>/input.jsp</to-view-id>
</navigation-case>
</navigation-rule>
...
</faces-config>
8
The following methods can be used to specify rules for selections according to the type of user operation:
· Specify the character string showing the action result for the value of the action attribute of a
UIComponent.
· Specify the method that returns the action result by using the method binding expression as the value of
the action attribute of a UIComponent.
For details on each method, refer to "Creating a Page Transition Definition".
2.7 Validators
JavaServer Faces supports a method for verifying data in UIComponents such as text fields in which users can
enter data.Data in a UIComponent is verified before updated data is set in properties of the managed bean
allocated to the UIComponent. If verification fails, properties of the managed bean are not updated.
JavaServer Faces defines the classes of a series of validators that implement standard data checks. In addition,
it provides basic tags corresponding to the standard validators.
Developers of input-output pages can register validators in UIComponents. The standard validators provided by
JavaServer Faces are available. In addition, custom validators can be created and used.
The procedure for using a validator is as follows:
1. Decide the validator to be used.
- Use a standard validator if it satisfies the function requirements.
- Otherwise, create and use a custom validator.
2. When using a custom validator, define it in the JavaServer Faces definition file (faces-config.xml).
3. Register the validator in a UIComponent on an input-output page.
For details on the following points of validator development, refer to "Creating a Validator":
· Standard validators provided by JavaServer Faces
· Creating and registering a custom validator
· Specifying a validator on an input-output page
2.8 Converters
When UIComponents are assigned to Bean properties, the data handled by JavaServer Faces is represented in
the following two formats:
· Format in which data is represented in data types, such as int and long, within a model
· Format in which data is represented in such a way that users can read, enter, and correct it
When a value on an input-output page is updated or when a Bean data value is changed by event processing,
conversion processing between the two formats is performed.Data is automatically converted in standard mode
unless otherwise specified. However, data may need to be converted to a specified format other than the
standard format.For this reason, JavaServer Faces enables converters to be registered in UIComponents.The
converters provided by JavaServer Faces can be used as well as custom converters created by users.
The procedure for using a converter is as follows:
1. Decide the converter to be used.
- Use a standard converter if it satisfies the requirements.
- Otherwise, create and use a custom converter.
2. Register the converter in a UIComponent on an input-output page.
For details on the following points of converter development, refer to "Creating a Converter":
· Standard converters provided by JavaServer Faces
· Creating a custom converter
· Specifying a converter on an input-output page
9
10
Chapter 3 Development of JavaServer Faces
Applications
This section explains a standard development method using JavaServer Faces. An event model application has
the following basic components:
Validator
Converter
package mypkg;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
11
}
Specify the name and scope of the created model in the JavaServer Faces definition file (faces-config.xml). In the
following example, the mypkg.MyBean class is registered with the name myBean, and the scope is session.
<faces-config>
<managed-bean>
<managed-bean-name>myBean</managed-bean-name>
<managed-bean-class>mypkg.MyBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
Specify the scope by selecting none, application, session, or request.If no scope is specified, none is
assumed, and the Bean is not saved to any scope, i.e., the Bean exists only while it is referenced.
The uri attribute identifies a tag library. The prefix attribute identifies the tag library to which a tag
belongs.The above example specifies that a component tag be preceded by h: and that a basic tag be preceded by
f: .
The JavaServer Faces tags represent a tree of UIComponents. The root of the tree is the UIViewRoot
component, which is represented by the f:view tag.
<f:view>
Other JavaServer Faces tags
</f:view>
HTML and JSP tags can be written outside the f:view tags, but JavaServer Faces tags must be written within
12
the scope enclosed by the f:view tags.
And, f:view corresponding to one screen is only one.
For details on the standard tags provided by JavaServer Faces and the display resulting from each tag, refer to
"Development Using JavaServer Faces Tags".
Using value binding expressions and method binding expressions, UIComponent tags can allocate Bean
properties to UIComponents and specify event processing, validators, and converters for them. An example is
shown below. Note that the example provides comments with <!-- --> for explanations, but no comment can
actually be written between the < and > of a tag.
<f:view>
<h:form>
<h:inputText
<!-- Assigns the myBean message property value to the
h:inputText value attribute. -->
value="#{myBean.message}"
<!-- Invokes the messageChanged method of myBean when the
value is changed. -->
valueChangeListener="#{myBean.messageChanged}" >
<!-- Specifies the maximum number of characters with a
validator. -->
<f:validateLength maximum="10"/>
</h:inputText>
<h:commandButton
<!-- Invokes the getIdForNextPage of myBean when the send
button is clicked. The resulting page transition is based on the
return value. -->
action="#{myBean.getIdForNextPage}"
value="Send"
<!-- Invokes the pushed method of myBean when the send button
is clicked. -->
actionListener="#{myBean.pushed}" />
</h:form>
</f:view>
For details on how to specify the following processing definitions, refer to the respective sections indicated next
to them:
· Event listener - Creating an Event Listener
· Converter - Creating a Converter
· Validator - Creating a Validator
· Page transition - Creating a Page Transition Definition
ActionEvent
The ActionEvent event occurs in a UIComponent that implements the
javax.faces.component.ActionSource interface.This event occurs when an anchor or button is clicked.To
use ActionEvent, use one of the following procedures:
· Specify the managed bean method by writing a method binding expression in the actionListener
attribute of the UIComponent tag. The argument to the specified method must be an instance of the
13
javax.faces.event.ActionEvent class, and the return value must be void. The specified method is
invoked when ActionEvent occurs.
· Create a class that implements the javax.faces.event.ActionListener interface. Write the
f:actionListener tags within the UIComponent tags, specifying the implementation class of
ActionListener. The processAction method of ActionListener is invoked when ActionEvent
occurs.
Examples of use of the actionListener attribute are shown below.
[JSP coding example]
import javax.faces.event.ActionEvent;
ValueChangeEvent
This event occurs in the UIComponent that implements the
javax.faces.component.EditableValueHolder interface.It occurs when the value of a tag (e.g., field,
combo box) having an input value is changed.To use ValueChangeEvent, use one of the following procedures:
· Specify the managed bean method by writing a method binding expression in the
valueChangeListener attribute of the UIComponent tag. The argument to the specified method must
be an instance of the javax.faces.event.ValueChangeEvent class, and the return value must be
void. The specified method is invoked when ValueChangeEvent occurs.
· Create a class that implements the javax.faces.event.ValueChangeListener interface. Write the
f:valueChangeListener tags within the UIComponent tags, specifying the implementation class of
ValueChangeListener. The processValueChange method of ValueChangeListener is invoked
when ValueChangeEvent occurs.
Note that ValueChangeEvent occurs not at the moment a value on the page is changed but at the moment the
request issued by the clicking of a button is sent to a server.
Examples of use of the f:valueChangeListener tag are shown below.
[JSP coding example]
14
[Event listener coding example]
package mypkg.listeners;
import javax.faces.event.ValueChangeEvent;
PhaseEvent
A PhaseEvent listener can be used for processing by causing an interrupt before or after a JavaServer Faces
phase.
This event listener can be used for unified preprocessing and postprocessing of business logic.Examples of use
are shown below.
[Event listener coding example]
import javax.faces.event.PhaseId;
<faces-config>
15
...
<lifecycle>
<phase-listener>mypkg.MyFacesListener</phase-listener>
</lifecycle>
...
</faces-config>
In the event coding example, the following can be specified for the return value of the getPhaseId method.
javax.faces.event.PhaseId.ANY_PHASE Interrupts any phase.
javax.faces.event.PhaseId.RESTORE_VIEW Interrupts the Restore View phase.
javax.faces.event.PhaseId.APPLY_REQUEST_VALUES Interrupts the Apply Request Values phase.
javax.faces.event.PhaseId.PROCESS_VALIDATIONS Interrupts the Process Validations phase.
javax.faces.event.PhaseId.UPDATE_MODEL_VALUES Interrupts the Update Model Values phase.
javax.faces.event.PhaseId.INVOKE_APPLICATION Interrupts the Invoke Application phase.
javax.faces.event.PhaseId.RENDER_RESPONSE Interrupts the Render Response phase.
Standard validators
The following three standard validators are available:
LengthValidator
This validator checks the length of value that is entered. It can check the minimum and
maximum values of the length.
DoubleRangeValidator
This validator checks whether a numeric value that has been entered is within the
specified range.
It can check the maximum and minimum values. The specifiable value is the range of
Double.
LongRangeValidator
This validator checks whether a numeric value that has been entered is within the
specified range.
It can check the maximum and minimum values. The specifiable value is the range of
Long.
16
<f:validateLongRange minimum="10" maximum="1000" />
The corresponding tags are prepared for these standard validators. They can be used by writing them within the
tags to be checked.
<h:inputText value="#{myBean.message}">
<f:validateLength minimum="5" maximum="9" />
</h:inputText>
<h:inputText value="#{myBean.message}"
validator="#{myBean.validate}" />
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;
17
}
Specify void for the return value of the method specified in the validator attribute. Use three arguments as
shown in the above coding example. Their contents are as follows:
· FacesContext instance
· UIComponent that specifies the validator attribute
· Value to be verified
For any error detected by the checking, error messages can be created and displayed with the
javax.faces.application.FacesMessage class, as shown in the above example. For details on how to
display it, refer to Displaying Messages.
Custom validators
A custom validator that implements arbitrarily defined check logic can be created.
A custom validator can be created by implementing the javax.faces.validator.Validator interface.
An example of a custom validator is shown below.
[Example of a custom validator]
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;
For any error detected by the checking, error messages can be created and displayed with the
javax.faces.application.FacesMessage class, as shown in the above example. For details on how to
display it, refer to Displaying Messages.
Assign a validator ID to the validator thus created, and save it to the JavaServer Faces definition file
18
(faces-config.xml). The validator ID myValidator is assigned to the validator in the following example.
<faces-config>
...
<validator>
<validator-id>myValidator</validator-id>
<validator-class>mypkg.MyValidator</validator-class>
</validator>
...
</faces-config>
<h:inputText value="#{myBean.message}">
<f:validator validatorId="myValidator" />
</h:inputText>
Standard converters
The following standard converters are available.
BigDecimalConverter Conversion to java.math.BigDecimal
BigIntegerConverter Conversion to java.math.BigInteger
BooleanConverter Conversion to java.lang.Boolean
ByteConverter Conversion to java.lang.Byte
CharacterConverter Conversion to java.lang.Character
DateTimeConverter Conversion to a pattern that can be specified for java.text.SimpleDateFormat
DoubleConverter Conversion to java.lang.Double
FloatConverter Conversion to java.lang.Float
IntegerConverter Conversion to java.lang.Integer
LongConverter Conversion to java.lang.Long
NumberConverter Conversion to a pattern that can be specified for java.text.DecimalFormat
ShortConverter Conversion to java.lang.Short
To use a converter, specify the ID of the converter by using the tag converter attribute or the f:converter
tag.
To use a standard converter, specify "javax.faces.[converter name excluding Converter]" as the converter ID.
For example, specify "javax.faces.BigDecimal".
Custom converters
A custom converter can be created to implement conversion to an arbitrarily specified object.Create a custom
19
converter by implementing the javax.faces.convert.Converter interface.
[Example of a custom converter]
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
Assign a converter ID to the converter thus created, and save it to the JavaServer Faces definition file
(faces-config.xml).
<faces-config>
...
<converter>
<converter-id>myConverter</converter-id>
<converter-class>mypkg.MyConverter</converter-class>
</converter>
...
</faces-config>
Using a converter
To use a converter, specify the ID of the converter. Specify the converter ID by writing it in the tag converter
attribute or using the f:converter tag.
Coding examples are shown below.
[convert attribute]
<h:inputText value="#{myBean.bigDecimal}"
converter="javax.faces.BigDecimalConverter" />
[f:converter tag]
20
<f:converter converterId="myConverter"/>
</h:inputText>
<faces-config>
...
<navigation-rule>
<!-- Write the transition source JSP name. -->
<from-view-id>/input.jsp</from-view-id>
<navigation-case>
<!-- Specify a transition to /input.jsp if the action result
is fail. -->
<from-outcome>fail</from-outcome>
<to-view-id>/input.jsp</to-view-id>
</navigation-case>
</navigation-rule>
...
</faces-config>
The "action result" defined in the JavaServer Faces definition file (faces-config.xml) is the value of the action
attribute of a button or anchor. The method of a page transition can be classified into the following two types
according to how the action attribute is specified: static action and dynamic action.
Static action
Static action means that a fixed character string is specified as the value of the action attribute.
Use this type of action when the page transition destination is fixed.
[Example of use of static action]
21
<h:commandButton action="success" value="Send" />
Dynamic action
Dynamic action means that a managed bean method is specified with a method binding expression for the
action attribute value. The specified method is invoked when ActionEvent occurs, and its return value is the
action result. The specified method must have no argument, and it must return String as the return value.
Use dynamic action when the page transition destination varies depending on the processing result of the
business logic.
[Coding example of a JSP page using dynamic action]
<h:commandButton action="#{myBean.getIdForNextPage}"
value="Send" />
package mypkg;
Associating messages with UIComponents according to processing other than validator processing
Associate messages with UIComponents by using the addMessage method of the
22
javax.faces.context.FacesContext class.Use the javax.faces.application.FacesMessage
class to render messages.An example of associating messages in an action method is shown below.
[Associating messages by using the addMessage method]
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
...
// Acquires FacesContext.
FacesContext context = FacesContext.getCurrentInstance();
// Creates a message.
FacesMessage message = new FacesMessage ("The product code does
not exist. Please check it.");
...
23
<f:view>
<h:form id="myForm">
Product code <h:inputText id="productCodeField"
value="#{myBean.product}" /> <br>
<!-- Displays a message about the "Product code" text field.
-->
<h:message for="productCodeField" /> <br>
...
<h:commandButton action="#{myBean.buyProduct}" value="Buy"/>
</h:form>
</f:view>
<f:view>
<h:form id="myForm">
<!-- Displays all messages. -->
<h:messages />
24
<%@ page contentType="text/html; charset=ISO-8859-1" %>
The character encoding of the request received from a browser is decided as follows. Therefore, the character
encoding of the request need not be specified in the application.
· When the Content-Type header exists in the HTTP request received from a browser, and the character
encoding is specified for the value, this character encoding is used.
· The same character encoding that transmits the last request of the same session is used, except for the
above-mentioned.
25
26
Chapter 4 Development Using JavaServer
Faces Tags
JavaServer Faces supports the tags listed below.
For details on each tag, refer to the JavaServer Faces Tag Reference.
Basic tags
Tag name Function
Registers an action listener for the parent
f:actionListner
UIComponent.
Registers a value change listener for the
f:valueChangeListner
parent UIComponent.
Specifies an attribute that can be
f:attribute
specified for the parent UICompnent.
Registers a converter in the parent
f:converter
UIComponent.
Registers a DateTime converter in the
f:convertDateTime
parent UIComponent.
Registers a Number converter in the
f:convertNumber
parent UIComponent.
Assigns a special name (e.g., a table
f:facet
header, footer) by enclosing it in this tag.
f:loadBundle Loads text from a resource file.
f:param Adds a parameter.
Displays the item from the UISelectOne
f:selectItem
or UISelectMany component.
Displays multiple items from the
f:selectItems
UISelectOne or UISelectMany component.
Loads another JSP page containing
f:subview
JavaServer Faces tags.
Registers DoubleRangeValidator in a
f:validateDoubleRange
UIComponent.
Registers LengthValidator in a
f:validateLength
UIComponent.
Registers LongRangeValidator in a
f:validateLongRange
UIComponent.
Registers a custom validator in a
f:validator
UIComponent.
Creates a UIOutput component that
f:verbatim
acquires the contents of this tag.
Encloses all of the JavaServer Faces tags
f:view
on a page.
HTML tags
Tag name Function Coding example Display
is used in
combination Refer to Examples of
h:column Use this tag in combination with
with combinations.
h:dataTable (refer to Examples
h:dataTable to
of combinations).
display one
27
Tag name Function Coding example Display
column of data
in a table.
Button (HTML <input>
Button used to tag; the type is submit,
<h:commandButton value="Send"
h:commandButton send form data action="send"/> reset, or image):
to a server
<h:commandLink action="send">
Hyperlink used Hyperlink (HTML <a
to send form <h:outputText href> tag):
h:commandLink
data to a value="Send"/>
server </h:commandLink>
Displays a
Use this tag in combination with
table based on h:column (refer to Examples of Examples of
h:dataTable
a set (e.g., combinations). combinations.
array) of data.
Refer to
<h:form>
Form (HTML <form>
h:form Creates a form. ...
tag)
</h:form>
<h:graphicImage
Displays an id="picture" Image (HTML <img>
h:graphicImage
image. url="/images/my_picture.gif" tag)
/>
<h:inputHidden
Creates hidden No display (HTML
h:inputHidden send data of a id="hidden" <input type=hidden>
form. value="#{myBean.hiddenPasswo tag)
rd}"/>
28
Tag name Function Coding example Display
a}"/>
Displays the
message of a <h:message
h:message
for="someComponentId"/> Message
specific
UIComponent.
Displays the
messages of all
h:messages <h:messages/> Messages
UIComponents
.
<h:outputLabel for="userId">
Displays a
label that <h:outputText id="userId" Label (HTML <label>
h:outputLabel
identifies an value="#{myBean.userid}"/> tag)
input field. </h:outputLabel>
<h:outputLink
Hyperlink to value="http://someHost/"> Hyperlink (HTML <a
another page <h:outputText href> tag):
h:outputLink
that creates no value="someHost"/>
action event
</h:outputLink>
Creates text by
inserting <h:outputFormat value="Total
parameters is {0}">
into it Text:
h:outputFormat <f:param
according to value="#{mybean.total}"/> Total is 123
the format and
then displays </h:outputFormat>
it.
<h:panelGrid columns="2"
border="1">
<f:facet name="header">
<h:outputText
value="table title"/> table title
Displays a
h:panelGrid
table. </f:facet> value1 value2
<h:outputText
value="value1" />
<h:outputText
value="value2" />
</h:panelGrid>
29
Tag name Function Coding example Display
<h:selectBooleanCheckbox
Check box (HTML <input
h:selectBooleanCh Single check type=checkbox> tag):
eckbox box value="#{myBean.selectBoolea
nCheckbox}" />
<h:selectManyCheckbox
value="#{myBean.selectManyCh
eckbox1}">
Multiple check boxes
<f:selectItem (HTML <input
h:selectManyCheck Multiple check itemLabel="Option 1"
box boxes type=checkbox> tag):
itemValue="check1"/>
<f:selectItem
itemLabel="Option 2"
itemValue="check2"/>
</h:selectManyCheckbox>
<h:selectManyListbox
value="#{myBean.selectManyLi
stbox}">
<f:selectItem List box (HTML <select>
List box from
itemLabel="List1" tag):
h:selectManyListb which multiple
ox options can be itemValue="List1"/>
selected <f:selectItem
itemLabel="List2"
itemValue="List2"/>
</h:selectManyListbox>
<h:selectManyMenu
List box with value="#{myBean.selectManyMe
nu}"> List box (HTML <select>
height 1 from
tag):
h:selectManyMenu which multiple <f:selectItems
options can be value="#{selectManyList}"/>
selected
</h:selectManyMenu>
30
Tag name Function Coding example Display
<f:selectItems
value="#{selectManyList}"/>
</h:selectOneListbox>
<h:selectOneMenu
value="#{myBean.selectOneMen
Combo box u}"> Combo box (HTML
from which a <select> tag):
h:selectOneMenu
single option <f:selectItems
can be selected value="#{selectManyList}"/>
</h:selectOneMenu>
<h:selectOneRadio
value="#{myBean.selectOneRad Multiple radio buttons
io}"> (HTML <input
Multiple radio type=radio> tag):
h:selectOneRadio
buttons <f:selectItems
value="#{selectManyList}"/>
</h:selectOneRadio>
[Examples of combinations]
Combination
Coding example Display
tags
<h:dataTable
value="#{myBean.items}"
var="item" border="1">
<h:column>
<f:facet
name="header">
<h:outputText
value="name"/>
</f:facet> name value
<h:outputText tableData1 memory1
h:dataTable value="#{item.name}" />
h:column tableData2 memory2
</h:column>
<h:column> tableData3 memory3
<f:facet
name="header">
<h:outputText
value="value"/>
</f:facet>
<h:outputText
value="#{item.value}"
/>
</h:column>
31
Combination
Coding example Display
tags
</h:dataTable>
<h:panelGrid
columns="2" border="1">
<f:facet
name="header">
<h:outputText
value="table title"/>
</f:facet>
<h:outputText
value="value1" />
table title
h:panelGrid <h:outputText
value="value2" /> value1 value2
h:panelGroup
<h:panelGroup> value3(*) value4
<h:outputText
value="value3" />
<h:outputText
value="(*)" />
</h:panelGroup>
<h:outputText
value="value4" />
</h:panelGrid>
32
Chapter 5 Development Using UJI Tags
5.1 Available UJI Tags
JavaServer Faces applications can use the UJI tags listed below.
For details of the UJI tags, refer to the UJI Tag Reference.
Basic tags
Tag name Explanation
Outputs values of managed bean properties to
uji:getProperty
the page.
Outputs the character strings defined in a
uji:resourceText
resource file.
33
Tag name Explanation
uji:fieldLong Integer input field
uji:fieldDouble Real number input field
uji:fieldBigInteger Decimal integer input field
uji:fieldBigDecimal Decimal fraction input field
uji:fieldDate Date/time input field
uji:fieldTextArea Multiple-line text input field
uji:checkBox Check box
uji:radioButton Radio button
uji:pushButton Pushbutton
uji:anchor Anchor
uji:label Label
uji:gridLayout
Layout for aligning items to a grid
uji:gridLayoutRenderer
uji:tabbedLayout Layout that can be switched by
tabbing (not available for Netscape
uji:tabbedLayoutRenderer 4.x)
<faces-config>
<managed-bean>
<managed-bean-name>myBean</managed-bean-name>
34
<managed-bean-class>mypkg.MyBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>
<f:view>
<uji:form name="myform" >
<uji:list bean="myBean" property="listModel" >
<uji:listRenderer type="list" >
<ul><uji:children /></ul>
</uji:listRenderer>
<uji:listRenderer type="element" >
<li><input name="<uji:name/>" value="<uji:value/>"></li>
</uji:listRenderer>
</uji:list>
<uji:pushButton label="Send" />
</uji:form>
</f:view>
35
(*1)This is shown to be able to use standard validators of JavaServer Faces.
Validators can be used in the same way as the standard validators of JavaServer Faces.
An example is shown below.
[Example of use of a validator with uji:fieldString]
<f:view>
<uji:form name="myform" >
<uji:fieldString bean="myBean" property="fieldString"
validator="#{myBean.validate}" />
<uji:pushButton label="Send" />
</uji:form>
</f:view>
[Sample validator]
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;
An exception message defined by a validator is displayed using the h:message tag or h:messages tag.
<f:view>
<uji:form name="myform" >
<uji:fieldString bean="myBean" property="fieldString"
validator="#{myBean.validate}"id
="fieldString1"/>
<h:message for="fieldString1" />
<uji:pushButton label="Send" />
</uji:form>
</f:view>
36
5.4 Using Converters
Converters can be used with the following UJI tags.
Standard
Tag name getAsObject(*1) getAsString(*2) Note
converters(*3)
uji:name The return
value of
uji:value getAsObject
uji:compositeName method
should be the
uji:input same as
uji:textarea property type
of bean.
uji:getProperty The type of
the third
uji:resourceText
argument of
getAsString
method is
uji:select
property type
of bean.
uji:fieldBigDecimal The return
value of
uji:fieldBigInteger getAsObject
uji:fieldDate method
should be
uji:fieldDouble String.
uji:fieldLong The type of
the third
uji:fieldString argument of
getAsString
uji:fieldTextArea method is
String.
(*1)This is shown to be able to use only when a request is set in a model (getAsObject of
javax.faces.convert.Converter interface).
(*2)This is shown to be able to use only when UIComponent values are displayed (getAsString of
javax.faces.convert.Converter interface).
(*3)This is shown to be able to use standard converters of JavaServer Faces.
Converters can be used in the same way as the standard converters of JavaServer Faces.
An example is shown below.
[Example of use of a converter with uji:getProperty]
<f:view>
<uji:getProperty bean="myBean" property="mypros">
<f:convertNumber pattern="#,##0.00" />
</uji:getProperty>
</f:view>
37
<f:view>
<uji:form name="myform" >
...
<uji:pushButton label="Send" action="#{mybean.doAction}" />
</uji:form>
</f:view>
If the selectedValue attribute is used, such as for one page that has multiple buttons, the button that has
been clicked can be specified in a managed bean. Code a value binding expression for the selectedValue
attribute.
In this case, the value of the item class specified by the bean and property attributes is set in the property
specified by selectedValue.
<f:view>
<uji:form name="myform" >
...
<uji:pushButton label="Send" bean="myBean"
property="pushButton"
action="#{mybean.doAction}"
selectedValue="#{mybean.selectedValue}" />
</uji:form>
</f:view>
To use a button or anchor with the uji:tableView or uji:treeView tag, specify aButton (for a button) or
aLink (for an anchor) in the column attribute. For aButton or aLink, use a method binding expression
following a colon ":" to specify the action to be invoked.
An example is shown below.
<f:view>
<uji:form name="myform" >
...
<uji:tableView bean="myBean" property="tableView"
dataCellType="data;data;aButton:#{mybean.doAction}" />
</uji:form>
</f:view>
38
-uji:select tag -uji:fieldLong tag
-uji:recordView tag -uji:fieldString tag
-uji:tableView tag -uji:fieldTextArea tag
-uji:treeView tag -uji:buttonList tag
-uji:listBox tag -uji:checkBox tag
-uji:radioButton tag -uji:comboBox tag
valueChangeListener can be used in the same way as the standard tags of JavaServer Faces.
An example is shown below.
[Example of use of valueChangeListener with uji:fieldString]
<f:view>
<uji:form name="myform" >
<uji:fieldString bean="myBean" property="fieldString"
valueChangeListener="#{myBean.valueChanged}" />
<uji:pushButton label="Send" />
</uji:form>
</f:view>
[Sample valueChangeListener]
import javax.faces.event.ValueChangeEvent;
In this case, the type of object acquired by the getNewValue or getOldValue method of the
ValueChangeEvent class varies depending on the tag.
Object type tag name
-uji:fieldBigDecimal
-uji:comboBox tag
tag
-uji:fieldBigInteger
-uji:name tag
tag
-uji:compositeName
-uji:fieldDate tag
tag
java.lang.String
-uji:fieldDouble tag -uji:input tag
-uji:fieldLong tag -uji:textarea tag
-uji:fieldString tag -uji:select tag
-uji:fieldTextArea
-uji:recordView tag
tag
39
Object type tag name
-uji:buttonList tag -uji:listBox tag
-uji:checkBox tag
If multipleMode is true with the following tags:
-uji:listBox tag
java.lang.String array
-uji:buttonList tag
-uji:select tag
40
Chapter 6 Using Apcoordinator Functions
JavaServer Faces applications can use the following Apcoordinator functions:
import com.fujitsu.uji.faces.FacesMimeSource;
Next, add enctype="multipart/form-data" to the uji:form tag. The uploaded file is stored at the location
specified by the bean attribute and property attribute.
<f:view>
<uji:form name="myform" method="post"
enctype="multipart/form-data" >
<uji:input type="file" bean="myBean" property="file" />
<uji:pushButton label="Send" action="#{mybean.doAction}"/>
</uji:form>
</f:view>
The action method can retrieve streams and files from FacesMimeSource.To store them on a server, specify the
absolute path to the server.
import java.io.InputStream;
.....
public String doAction() {
String fileName = null;
41
InputStream is = null;
if (file != null) {
fileName = file.getFileName();
is = file.getInputStream();
}
....
}
.....
Use an application class and initialization parameters to specify file transfer parameters.
The maximum transfer size and the size of memory used for transfer (a work file is used if the memory size is
exceeded) can be specified by overriding methods of the application class as shown below. The default maximum
transfer size is 16 MB, and the default memory size is 1 MB.
The maximum size for a request parameter analysis can be specified with an initialization parameter
(uji.mimeParseSizeLimit). The default value is five times the maximum size for a file transfer. If a file exceeding
the maximum transfer size is uploaded, file data is abandoned, but request parameter analysis continues until
the maximum size for a request parameter analysis is reached.
<!--
Maximum size (in bytes) for a parameter analysis applicable
when a file is uploaded
Specify 40 MB as the maximum size for a parameter analysis.
-->
<context-param>
<param-name>uji.mimeParseSizeLimit</param-name>
<param-value>41943040</param-value>
</context-param>
42
The information contained in the upload header includes the file name and item names. Depending on
the browser used, about 970 bytes can be specified as the total length of the file name and item names.
If the upload header length exceeds 1024 bytes, the UUIRuntimeException exception wrapped around
IOException is thrown.
· The default maximum size for an upload file is 16 MB (16*1024*1024 bytes). As explained above, this size
can be changed by overriding the getMimeTransferSizeLimit method of the application class.
If the maximum size for an upload file is exceeded, the streams acquired from FacesMimeSource become
null.
· The default maximum size for a request parameter analysis is 80 MB (16*1024*1024*5 bytes). As
explained above, this size can be changed by specifying an initialization parameter
(uji.mimeParseSizeLimit).
If the size of the request parameter exceeds the upper limit, the UUIRuntimeException exception
wrapped around IOException is thrown.
import java.io.File;
import com.fujitsu.uji.faces.FacesMimeSupport;
public class MyBean {
.....
public String download() {
// Acquires the file to be downloaded.
File file = getDownloadFile();
try {
// Executes downloading.
FacesMimeSupport.fillResponse(file);
} catch(Exception e) {
e.printStackTrace();
}
return "ok";
}
.....
}
<f:view>
<uji:form name="myform" >
<uji:pushButton bean="myBean" property="button"
label="download" action="#{mybean.download}"/>
</uji:form>
</f:view>
43
com.fujitsu.uji.faces.FacesFactory.
import javax.faces.context.FacesContext;
import com.fujitsu.uji.faces.FacesFactory;
import com.fujitsu.uji.ApplicationProfile;
import com.fujitsu.uji.log.LogComposer;
For details on how to create and use an application class, refer to the Apcoordinator User's Guide.
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import com.fujitsu.uji.ext.Call;
import com.fujitsu.uji.ext.CallFactory;
import com.fujitsu.uji.ext.InitialCallFactory;
import com.fujitsu.uji.ResponseBean;
44
} catch(Throwable e){
...
}
...
}
}
The unified remote interface invokes an EJB or Web service by using an extended Bean of
com.fujitsu.uji.DataBean (hereafter referred to as a data Bean) as an argument. Therefore,
the following is recommended: before using the unified remote interface, create a managed bean
as a data Bean.
45
46
Chapter 7 Setting Up the Runtime
Environment
7.1 Runtime File Mapping
The following figure shows the standard file mapping when JavaServer Faces applications are running.
JSP files
Allocate these files into the application folder or a subfolder in the folder.
User files
Similar to JSP files, allocate static documents such as images into the application folder or a subfolder.
User classes
Allocate user-defined class files in the WEB-INF¥classes folder, preserving their package hierarchy.
For example, place MyBean.class of the mypkg package in WEB-INF¥classes¥mypkg.
47
7.2 Files Required for Execution
Tag library file
When using UJI tags, copy the following file to the WEB-INF folder.
Tag library name Function
ujijsf.tld Tag library file required for use of UJI tags by JavaServer Faces applications
Runtime libraries
The following JAR files are required for JavaServer Faces applications.
JAR file name Method of use
jsf-api.jar Specify this file in the container classpath.
jsf-impl.jar
jstl.jar
commons-beanutils.jar
Copy these files to the WEB-INF¥lib folder.
commons-collections.jar
commons-digester.jar
commons-logging.jar
The following files are required for use of UJI tags.
File
Method of use
name
uji.jar Specify these files in the container
ujijsf.jar classpath.
Installation folder
The installation folder of the tag library file and runtime libraries is as follows.
Platform Default installation folder
Windows C:¥Interstage¥APC¥lib¥
Solaris OE
/opt/FJSVwebc/lib/
Linux
48
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>factory</param-name>
<param-value>mypkg.MyFactory</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>ujijsf-taglib</taglib-uri>
<taglib-location>/WEB-INF/ujijsf.tld</taglib-location>
</taglib>
</web-app>
JavaServer Faces specification says thatthe state of UI components is saved on the server side or
on the client side.To specify where the state of UI components is saved,set the
javax.faces.STATE_SAVING_METHOD context parameter to client (which means that the
state is saved on the client side) or server (which means that the state is saved on the saver
side.)The default is server.When the state is saved on the client side,there will be the following
security problemsbecause the state of UI components is serialized and a HTML document includes
a hidden parameter whose value is the serialized state of UI components.So, it is recommended
that the javax.faces.STATE_SAVING_METHOD context parameter is omitted, or set to server.
· A malicious user can get values which are entered in a Web page by getting the page in a
Web browser cache, and decoding a hidden parameter in the Web page.
· A malicious user can create any UI component tree on the server by making a serialized
49
data and sending it to the server as a request parameter.
50
Appendix A UIComponents Corresponding to
UJI Tags
A.1 UIComponent Specifications
The table below lists the UIComponent classes corresponding to UJI tags.
When coding programs using JavaServer Faces APIs, refer to this information for casting a UIComponent to the
javax.faces.component package class or interface.
The name of each UIComponent class corresponding to a UJI tag is "UUI" + "Tag name (beginning with an
uppercase letter)".
(Example: The class name of the UIComponent corresponding to the uji:form tag is UUIForm.)
No UIComponent corresponds to the uji:colorMap tag.
In the "Implemented interface" columns in the table below, "O" indicates that a UIComponent implements one of
the following interfaces:
· javax.faces.component.ValueHolder
· javax.faces.component.EditableValueHolder
· javax.faces.component.ActionSource
· javax.faces.component.NamingContainer
The "value type" column in the table lists the type of the value acquired by getValue when a UIComponent
implements the ValueHolder interface.
Implemented interface
UIComponent class ValueH EditableValu ActionS NamingCo Value type
older eHolder ource ntainer
com.fujitsu.uji.faces.script.UUIAc
- - - - -
tion
com.fujitsu.uji.faces.model.UUIAn
O (*1) - O - Any (*6)
chor
com.fujitsu.uji.faces.layout.UUIBo
- - - - -
rderLayout
com.fujitsu.uji.faces.layout.UUIBo
- - - - -
rderLayoutRenderer
com.fujitsu.uji.faces.collect.UUIB
O (*1) O (*2) - - String[] (*7)
uttonList
com.fujitsu.uji.faces.model.UUICa
- - - - -
se
com.fujitsu.uji.faces.field.UUIChe
O (*1) O (*2) - - String
ckBox
com.fujitsu.uji.faces.model.UUICh
- - - - -
ildren
com.fujitsu.uji.faces.collect.UUICo
O (*1) O (*2) - - String[] (*7)
mboBox
com.fujitsu.uji.faces.model.UUICo
- - - O -
mposite
com.fujitsu.uji.faces.model.UUICo
O O (*3) - - Any (*8)
mpositeName
com.fujitsu.uji.faces.model.UUICo
- - - - -
mpositeRenderer
com.fujitsu.uji.faces.field.UUIFiel
O O (*3) - - String
dBigDecimal
51
Implemented interface
UIComponent class ValueH EditableValu ActionS NamingCo Value type
older eHolder ource ntainer
dBigInteger
com.fujitsu.uji.faces.field.UUIFiel
O O (*3) - - String
dDate
com.fujitsu.uji.faces.field.UUIFiel
O O (*3) - - String
dDouble
com.fujitsu.uji.faces.field.UUIFiel
O O (*3) - - String
dLong
com.fujitsu.uji.faces.field.UUIFiel
O O (*3) - - String
dString
com.fujitsu.uji.faces.field.UUIFiel
O O (*3) - - String
dTextArea
com.fujitsu.uji.faces.script.UUIFo
- - - O -
rm
com.fujitsu.uji.faces.basic.UUIGet
O - - - Any (*8)
Property
com.fujitsu.uji.faces.layout.UUIGr
- - - - -
idLayout
com.fujitsu.uji.faces.layout.UUIGr
- - - - -
idLayoutRenderer
com.fujitsu.uji.faces.script.UUIIn
O O (*3) - - Any (*9)
put
com.fujitsu.uji.faces.layout.UUILa
- - - - -
bel
com.fujitsu.uji.faces.model.UUILi
- - - O -
st
com.fujitsu.uji.faces.collect.UUILi
O (*1) O (*2) - - String[] (*7)
stBox
com.fujitsu.uji.faces.model.UUILi
- - - - -
stRenderer
com.fujitsu.uji.faces.model.UUINa
O O (*3) - - Any (*10)
me
com.fujitsu.uji.faces.collect.UUIP
O (*1) - O - Any (*6)
ushButton
com.fujitsu.uji.faces.collect.UUIR
O (*1) O (*2) - - Any (*11)
adioButton
com.fujitsu.uji.faces.collect.UUIRe
O (*1) O (*3) - - String[] (*12)
cordView
com.fujitsu.uji.faces.basic.UUIRes
O (*4) - - - String
ourceText
com.fujitsu.uji.faces.script.UUISel
O O (*3) - - Any (*8)
ect
com.fujitsu.uji.faces.model.UUIS
- - - - -
witch
com.fujitsu.uji.faces.layout.UUITa
- - - - -
bbedLayout
com.fujitsu.uji.faces.layout.UUITa - - - - -
52
Implemented interface
UIComponent class ValueH EditableValu ActionS NamingCo Value type
older eHolder ource ntainer
bbedLayoutRenderer
com.fujitsu.uji.faces.model.UUITa
- - - O -
ble
com.fujitsu.uji.faces.model.UUITa
- - - - -
bleRenderer
com.fujitsu.uji.faces.collect.UUITa com.fujitsu.uji.faces.
O (*1) O (*3) O (*5) -
bleView collect.TableValue
com.fujitsu.uji.faces.script.UUITe
O (*1) O (*3) - - Any (*8)
xtarea
com.fujitsu.uji.faces.model.UUITr
- - - O -
ee
com.fujitsu.uji.faces.model.UUITr
- - - - -
eeRenderer
com.fujitsu.uji.faces.collect.UUITr com.fujitsu.uji.faces.
O (*1) O (*3) O (*5) -
eeView collect.TreeValue
com.fujitsu.uji.faces.script.UUIVal
- - - - -
idate
com.fujitsu.uji.faces.model.UUIVa
O - - - Any (*10)
lue
*1 The setConverter method cannot be used.
*2 The setValidator, addValidator, and setRequired methods cannot be used.
*3 The setRequired method cannot be used.
*4 The setValue method cannot be used.
*5 The setAction method cannot be used.
*6 This is the property value specified by the selectedValue attribute.
*7 The array element is the value of the selected option. If no option is selected, the array length is
0.
*8 This is the property value specified by the bean or property attribute.
*9 If a value is specified in the value attribute, this is the specified value. Otherwise, it is the
value specified by the bean or property attribute.
*10 This is the value of the current object.
*11 This is the property value specified by the selectedBean or selectedProperty attribute.
*12 The ith element of the array is the value of the getValueAt(i) of the item class.
53
Basic tags
54
Client script tags
55
Screen part tags
56
Component tags (field)
57
Component tags (collection)
58
Component tags (layout)
59
60
Terms
ActionEvent
An event which occurs at such times as when the user clicks a button or anchor. To utilize the ActionEvent,
specify the actionListener attribute to a tag or specify the f:actionListener tag in the content of a tag.
action method
A method to process actions which occur in JavaServer Faces tags. The action attribute of a JavaServer Faces
tag specifies an action method using a method binding expression.
component family
An identifier which is used to create an instance of a renderer corresponding to the UIComponent.
component tree
A set of Java objects representing hierarchy of JavaServer Faces tags in an input-output page. The component
tree is on the server side.
component type
An identifier which is used to create an instance of the UIComponent.
converter
A converter converts between a model data object and the String representation of the model data object, i.e.,
from an object to String and from String to an object. String representation is used to display the model data.
61
event
There are three types of events, the ActionEvent, the ValueChangeEvent, and the PhaseEvent.
JavaServer Faces
JavaServer Faces is a set of specifications drawn up as JSR-127 by the Java Community Process (JCP). It is an
application framework for creating Web application user interfaces.
lifecycle
A sequence of processes, which starts with receiving a request by a JavaServer Faces application, and which
ends with returning a response.
managed bean
A bean to store values which is displayed on the screen or submitted by a web browser. The bean has properties
and accessor methods (i.e., setter and getter methods) to store and get values. The bean may have event
listeners.
navigation rule
A rule defining a next view based on the view ID of the current view. Navigation rules are described in the
JavaServer Faces definition file using the navigation-rule tag.
PhaseEvent
The PhaseEvent enables an application to interrupt before or after a JavaServer Faces phase and execute a
process.
62
Process Validations phase
A phase in which all validators associated with the page to be displayed are processed.
RenderKit
A RenderKit is a collection of renderer instances. A RenderKit recognizes a suitable representation of
UIComponent instance for a specific type of client.
UIComponent
A base class of all user interface components of JavaServer Faces.
validator
A method or a class which verifies values in a submitted form. The validator is invoked in the Process
Validations phase in the lifecycle.
63
ValueChangeEvent
An event which occurs in the UIComponent that implements the
javax.faces.component.EditableValueHolder interface. It occurs when the value of a tag (e.g., field,
combo box) having an input value is changed.
64