Example usage for org.apache.commons.beanutils.converters DateConverter setLocale

List of usage examples for org.apache.commons.beanutils.converters DateConverter setLocale

Introduction

In this page you can find the example usage for org.apache.commons.beanutils.converters DateConverter setLocale.

Prototype

public void setLocale(Locale locale) 

Source Link

Document

Set the Locale for the Converter.

Usage

From source file:org.metawidget.example.struts.addressbook.plugin.AddressBookPlugIn.java

public void init(ActionServlet servlet, ModuleConfig config) {

    ServletContext context = servlet.getServletContext();

    // Application-wide Controllers

    context.setAttribute("contacts", new ContactsController());
    context.setAttribute("communications", new CommunicationsController());

    // Application-wide Converters

    ConvertUtils.register(new EnumConverter(), ContactType.class);
    ConvertUtils.register(new EnumConverter(), Gender.class);
    ConvertUtils.register(new ToStringConverter(), String.class);

    DateConverter converterDate = new DateConverter();
    converterDate.setLocale(Locale.getDefault());
    ConvertUtils.register(converterDate, Date.class);
}