Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using <f:convertDateTime> with <h:commandLink>

I saw this example provided by BalusC:

<h:outputText value="#{bean.calendar.time}">
    <f:convertDateTime type="both" dateStyle="long" />
</h:outputText>

How is that working with <h:commandLink> ?

I tried:

<h:commandLink value="#{question.creationDate.time}"
    action="#{managerBean.searchQuestion()}">
  <f:convertDateTime type="both" dateStyle="short" />
  <f:setPropertyActionListener target="#{managerBean.questionID}"
    value="#{question.ID}" />
</h:commandLink>
like image 869
alexander Avatar asked Jan 31 '26 08:01

alexander


1 Answers

Put <h:outputText> inside <h:commandLink>.

<h:commandLink action="#{managerBean.searchQuestion}">
    <h:outputText value="#{question.creationDate.time}">
        <f:convertDateTime type="both" dateStyle="short" />
    </h:outputText>
    <f:setPropertyActionListener target="#{managerBean.questionID}" value="#{question.ID}" />
</h:commandLink>
like image 193
BalusC Avatar answered Feb 02 '26 03:02

BalusC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!