org.jboss.seam.faces
@Converter(forClass=java.util.Date.class) @Name(value="org.jboss.seam.faces.dateConverter") @Install(precedence=0, classDependencies="javax.faces.context.FacesContext") @BypassInterceptors public class DateConverter extends javax.faces.convert.DateTimeConverter
This converter is provided to save a developer from having to specify a DateTimeConverter on an input field or page parameter. By default, it assumes the type to be a date (as opposed to a time or date plus time) and uses the short input style adjusted to the Locale of the user. For Locale.US, the input pattern is mm/DD/yy. However, to comply with Y2K, the year is changed from two digits to four (e.g., mm/DD/yyyy).
It's possible to override the input pattern globally using component configuration. Here is an example of changing the style to both and setting the date and time style to medium.
org.jboss.seam.faces.dateConverter.type=both org.jboss.seam.faces.dateConverter.dateStyle=medium org.jboss.seam.faces.dateConverter.timeStyle=medium
Alternatively, a fixed pattern can be specified.
org.jboss.seam.faces.dateConverter.pattern=yyyy-mm-DD
Constructor and Description |
---|
DateConverter() |
Modifier and Type | Method and Description |
---|---|
void |
create() |
Object |
getAsObject(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String value) |
String |
getAsString(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Object value) |
static javax.faces.convert.Converter |
getInstance() |
Locale |
getLocale() |
TimeZone |
getTimeZone() |
@Create public void create()
public TimeZone getTimeZone()
getTimeZone
in class javax.faces.convert.DateTimeConverter
public Locale getLocale()
getLocale
in class javax.faces.convert.DateTimeConverter
public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value) throws javax.faces.convert.ConverterException
getAsObject
in interface javax.faces.convert.Converter
getAsObject
in class javax.faces.convert.DateTimeConverter
javax.faces.convert.ConverterException
public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value) throws javax.faces.convert.ConverterException
getAsString
in interface javax.faces.convert.Converter
getAsString
in class javax.faces.convert.DateTimeConverter
javax.faces.convert.ConverterException
public static javax.faces.convert.Converter getInstance()
Copyright © 2015 Seam Framework. All Rights Reserved.