Name

DateTimeConverter

Synopsis

An instance of this class is used as a Converter for java.util.Date values.

Synopsis

Class name:

javax.faces.convert.DateTimeConverter

Extends:

None

Implements:

javax.faces.convert.Converter, javax.faces.component.StateHolder

Fields

public static final String CONVERTER_ID

The identifier for this converter: javax.faces.DateTime.

Constructors

public DateTimeConverter()

Creates an instance.

Methods

public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)

Converts the provided String value (which can be null) to a Date instance and returns the new instance. Returns null if the value is null or an empty string (after trimming); otherwise, parses the value in the same way as java.text.SimpleDateFormat in nonlenient mode, guided by the dateStyle, pattern, timeStyle, timeZone and type property value for the Locale specified by the locale property or the view’s Locale. Throws a ConverterException if the conversion fails.

public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)

Converts the provided Date value (which can be null) to a String instance and returns the new instance, formatted in the same way as by java.text.SimpleDateFormat, guided by the dateStyle, pattern, timeStyle, timeZone, and type properties for the Locale specified by the locale property or the view’s Locale. Throws a ConverterException if the ...

Get JavaServer Faces now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.