HTML and CSS Reference
In-Depth Information
every input text. This is because JSF conversion (and also JSF validation) must be applied for every component that
has converters (and/or validators), which means that the JSF validation process (which includes both conversion and
validation) cannot be aborted midway because the framework has to collect all of the error messages in one shot.
Standard JSF Converters
Now, let's dive into the details of the JSF standard converters. Table 3-1 shows JSF standard converters.
Table 3-1. JSF Standard Converters
Converter ID
Description
javax.faces.Boolean
Implicit converter that can be applied to Boolean and boolean Java types.
javax.faces.Byte
Implicit converter that can be applied to Byte and byte Java types.
javax.faces.Character
Implicit converter that can be applied to Character and char Java types.
javax.faces.Short
Implicit converter that can be applied to Short and short Java types.
javax.faces.Integer
Implicit converter that can be applied to Integer and int Java types.
javax.faces.Long
Implicit converter that can be applied to Long and long Java types.
javax.faces.Float
Implicit converter that can be applied to Float and float Java types.
javax.faces.Double
Implicit converter that can be applied to Double and double Java types.
javax.faces.BigDecimal
Implicit converter that can be applied to BigDecimal Java type.
javax.faces.BigInteger
Implicit converter that can be applied to BigInteger Java type.
javax.faces.Number
Explicit converter that can be used to convert user input to Number Java type.
javax.faces.DateTime
Explicit converter that can be used to convert user input to java.util.Date Java type.
As shown in the table, the JSF converters have two types:
Implicit converters.
Explicit converters.
Implicit converters are applied automatically to the listed value types. For example, assume we have the following
Calculator managed bean, as shown in Listing 3-3.
Listing 3-3. The Calculator Managed Bean
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
@ManagedBean
@RequestScoped
public class Calculator implements Serializable {
private Double firstNumber;
private Double secondNumber;
private Double result;
 
 
Search WWH ::




Custom Search