2013-12-13 11 views
3

我看到BalusC提供的這個例子:使用的<f:convertDateTime>與<H:commandLink>時

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

如何是與< 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> 

回答

8

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

完美的作品!我沒想到,我可以在<:hcommandLink>中使用。 – alexander