使用<f:convertdatetime>与<h:commandlink> </h:commandlink> </f:convertdatetime>

时间:2013-12-13 18:06:24

标签: jsf datetime commandlink

我看到BalusC提供的这个例子:

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

如何使用&lt; h:commandLink>

我试过了:

<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>

1 个答案:

答案 0 :(得分:9)

<h:outputText>放入<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>