Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 552829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:32:28+00:00 2026-05-13T11:32:28+00:00

I am trying to register different converter instances in the faces-config, using a standard

  • 0

I am trying to register different converter instances in the faces-config, using a standard converter class to which different parameters are passed.

The code below registers two DateTimeConverters, the first one for dates including time and the second one for time only. But the pattern property never gets set. Can this be done?

<converter>
    <converter-id>dateTimeConverter</converter-id>
    <converter-class>javax.faces.convert.DateTimeConverter</converter-class>
    <property>
        <property-name>pattern</property-name>
        <suggested-value>yyyy-MM-dd HH:mm:ss</suggested-value>
    </property>
</converter>

<converter>
    <converter-id>timeConverter</converter-id>
    <converter-class>javax.faces.convert.DateTimeConverter</converter-class>
    <property>
        <property-name>pattern</property-name>
        <suggested-value>HH:mm:ss</suggested-value>
    </property>
</converter>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:32:29+00:00Added an answer on May 13, 2026 at 11:32 am

    This is unfortunately not possible through faces-config.xml. The <property> declaration which you’re trying is not used during runtime.

    If all you want is to control the pattern at one place, then best what you can do is to create a custom converter. For this particular purpose it isn’t that hard. Just extend DateTimeConverter and set the pattern during construction. Here’s a basic example:

    public MyDateTimeConverter extends DateTimeConverter() {
        public MyDateTimeConverter() {
            setPattern("yyyy-MM-dd HH:mm:ss");
        }
    }
    

    You can of course get the pattern from somewhere else, e.g. a properties file or xml file in classpath.

    Register this converter as follows:

    <converter>
        <converter-for-class>java.util.Date</converter-for-class>
        <converter-class>com.example.MyDateTimeConverter</converter-class>
    </converter>
    

    That should be it. No need for f:converter or UIOutput#setConverterId().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to register the following class using the fluent interface: public class
I am trying to do some experiments using different segments besides the default code
I'm trying to register an externally hosted SQL 2000 server through Enterprise Manager which
I'm trying to register an atl service using ExeName.exe /service as described here: http://msdn.microsoft.com/en-us/library/74y2334x(VS.80).aspx
I'm currently trying to register a JS function call from a .NET page which
I am trying to register a custom HttpHandler in the web.config file. MSDN's example
I am trying to register an interceptor using a annotation-driven controller configuration. As far
I'm currently trying to make a class that can register strings as identifiers and
i'm trying to use C2DM client with this tutorial:http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html I'm using this code for
Using PyFacebook I am trying to register a test user of my site with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.