Note that there are some explanatory texts on larger screens.

plurals
  1. POFormat the date using <f:convertDateTime> and display it in the <h:outputText>
    primarykey
    data
    text
    <p>I want to display something like "2010-10-20 by Mary" in the h:outputText. The date value is stored inside the MBean 's field called date1 while the user name is stored inside the MBean 's field called username. I use the following EL expression and UI control: </p> <pre><code>&lt;h:outputText value="#{MBean.date1} by #{MBean.username}"&gt; &lt;f:convertDateTime pattern="YYYY-MM-DD" timeZone="#{configMB.timeZone}" /&gt; &lt;/h:inputText&gt; </code></pre> <p>The value can be displayed .However, it ignores the date format specified by f:convertDateTime. No matter how I change the data format, it always display something like "<strong>2010-06-08 12:35:22.0</strong> by Mary". How can I solve this problem?? </p> <p>Update :Zenzen 's solution works with the following code changes. </p> <pre><code>&lt;h:outputFormat value="{0, date, yyyy-MM-dd} by #{1}"&gt; &lt;f:param value="#{MBean.date1}" /&gt; &lt;f:param value="#{MBean.username}" /&gt; &lt;/h:outputFormat&gt; </code></pre> <p>However can I format the value of a read-only <code>h:inputText</code> using the method likes <code>h:outputFormat</code> and <code>&lt;f:param&gt;</code>? Sometimes the value displayed is so long and using <code>&lt;h:outputFormat&gt;</code> will generate the span tag which encloses the formatted message .I want to have an effect like <code>&lt;input type="text"&gt;</code> , which the UI control has the fixed length and user can scroll to see the message if the message is too long. Or alternative , how can I format the span tag that make the behavior looks like a <code>&lt;input type="text"&gt;</code> using css or javascript?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload