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

  • SEARCH
  • Home
  • 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 9177683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:22:55+00:00 2026-06-17T17:22:55+00:00

Example: <h:form> <h:selectOneMenu value=#{bean.timezone}> <f:selectItems value=#{bean.availableTimezones} … > <f:ajax render=currenttime /> </h:selectOneMenu> </h:form> <h:form

  • 0

Example:

<h:form>
    <h:selectOneMenu value="#{bean.timezone}>
        <f:selectItems value="#{bean.availableTimezones} ... >
        <f:ajax render="currenttime" />
    </h:selectOneMenu>
</h:form>

<h:form id="currenttime">
    <h:outputText value="#{bean.currentTime}" >
        <f:convertDateTime dateStyle="short" type="both" timeZone="#{bean.timezone}" />
    </h:outputText>
</h:form>

<!-- bean.currentTime is of type 'Date' -->

In the example, changing the timezone should cause the text in currenttime to show in the proper timezone. But it doesn’t.

I figured this happens because converters are calculated in “Apply Request” phase and the value of the selected timezone is updated in “Update Model” phase.

Am I right?
Should I not use converters for this?

Thanks!

  • 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-06-17T17:22:57+00:00Added an answer on June 17, 2026 at 5:22 pm

    Your concrete problem is caused because <f:convertDateTime> is initialized during view build time, not during view render time (exactly like JSTL and so on). Indeed, this runs far before update model values phase and hence the converter will not get set with the user-submitted timezone during view render time.

    This problem has basically the same grounds as answered in the following answers:

    • How to set converter properties for each row of a datatable?
    • JSF convertDateTime with timezone in datatable

    One of the ways is managing and binding the converter instance as a bean property.

    private DateTimeConverter converter;
    
    @PostConstruct
    public void init() {
        converter = new DateTimeConverter();
        converter.setDateStyle("short");
        converter.setType("both");
    }
    
    public DateTimeConverter getDateTimeConverter() {
        converter.setTimeZone(timezone);
        return converter;
    }
    

    With

    <h:outputText value="#{bean.currentTime}" >
        <f:converter binding="#{bean.dateTimeConverter}" />
    </h:outputText>
    

    An alternative is using OmniFaces <o:converter which supports rendertime evaluation of converter’s properties:

    <h:outputText value="#{bean.currentTime}" >
        <o:converter converterId="javax.faces.DateTime" dateStyle="short" type="both" timeZone="#{bean.timezone}" />
    </h:outputText>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example to save gender <form action=save.php?id=<?=$id?> method=post> <p><label><input name=gender type=radio value=male <?php if($gender=='male'){?>checked=checked<? }?>
How to count values of two drop down using ajax or php Example Form
Example form, https://stackoverflow.com/questions/ask and I save this page to desktop. Then I edit the
Beginner help needed :) I am doign an example form a php book which
In Java, I've these key/value pairs passed by post (for example): form_id=undefined frmb[0][cssClass]=input_text frmb[0][required]=checked
I know if on my own webpage, if my user is on : http://www.example.com/form.php
I have a form (for example, abc.frm ). I want the duplicate form (for
i saw a example for login form same blow code class Form_Login extends Zend_Form
For example: A user submits a form with a <textarea name=mytext cols=35 rows=2></textarea> and
For example what do the around #Trim(FORM.fromfirstname)# do? I'm adding <cfqueryparam...> tags and am

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.