0

I want to hide commandLink if following condition exists:

verifyTxnList.resolved where resolved has value Y then I want to hide commandLink else show commandLink

<h:commandLink value="#{verifyTxnList.resolved}">
       ...
       ...                
</h:commandLink>

like following :

<h:selectBooleanCheckbox  id="resolveTxn" value="#{verifyTxnList.checked}" disabled="" rendered="#{!verifyTxnList.checked}"/>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Yubaraj
  • 3,800
  • 7
  • 39
  • 57

1 Answers1

2

If you don't want the component to render its HTML output (if the rendered condition is false), you can use the rendered attribute. In this case, you can't have the component shown, without having the page re-rendered and the rendered condition evaluated to true.

<h:commandLink rendered="#{verifyTxnList.resolved == 'Y'}" />

More info about rendered:

Community
  • 1
  • 1
Konstantin Yovkov
  • 62,134
  • 8
  • 100
  • 147
  • You can also wrap the link in a container (h:panelGroup for example) and ajax-update that container to conditionally show or hide the link. – Gimby Sep 06 '13 at 12:17
  • First option is completely wrong. This attribute doesn't exist on the `` at all. See also http://docs.oracle.com/javaee/6/javaserverfaces/2.1/docs/vdldocs/facelets/h/commandButton.html for a list of all valid attribtues. Please remove this misinformation, then I'll remove the downvote. In future answers which you can't answer off top of head, please test yourself first in a true JSF playground project before posting. – BalusC Sep 06 '13 at 12:18