Link to home
Start Free TrialLog in
Avatar of prain
prainFlag for United States of America

asked on

How to make a p:commadLink visible/invisible?

At the start of a page I have a p:commandLink that MUST be made invisible. Then on the same page, at a button press I do some processing on the server side in a bean. If the calculations allow, I am supposed to "Make the p:commandLink" visible to the user. What are the properties I need to set at the start on the commandLink to make it invivible and then toggle it on the Server Side to make it visible?

Here is the part of that jsf code.
the cmdLinkRewActions is the commandLink that I want to make invisible at the start and them when the cmdLinkActions is clicked the cmdLinkRewActions is made visible based on a calculation in services.makeVisibleActions().

So how and what properties of cmdLinkRewActions  I have to handle. I have seen the p:commandLink properties on Prime Faces Show Case but did not do any good to me.

<table>
  <tr>
     <td colspan="2">
      <p:commandLink id="cmdLinkActions" value="Actions"
         actionListener="#{services.makeVisibleActions()}" />
      <br />
    </td>
 </tr>
 <tr>
     <td colspan="2">
      <p:commandLink  id="cmdLinkRewActions" value="Review Actions"      
       actionListener="#{services.goToReviewActions ()}" />
  <br />
 </td>
</tr>
Avatar of girionis
girionis
Flag of Greece image

Use the "rendered" attribute

<p:commandLink id="cmdLinkActions" value="Actions" rendered="true"
         actionListener="#{services.makeVisibleActions()}" />

Open in new window


and set it to false in order to hide the commandLink.
Avatar of prain

ASKER

Sorry it did not work. At the start, I want cmdLinkRewActions to be invisible. So I typed

<table>
  <tr>
     <td colspan="2">
      <p:commandLink id="cmdLinkActions" value="Actions"
         actionListener="#{services.makeVisibleActions()}" />
      <br />
    </td>
 </tr>
 <tr>
     <td colspan="2">
      <p:commandLink  id="cmdLinkRewActions" value="Review Actions"     rendered="false"
       actionListener="#{services.goToReviewActions ()}" />
  <br />
 </td>
</tr>



I expected NOT TO SEE the cmdLinkRewActions at the start. But still it is showing up.
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of prain

ASKER

Now that works. Thanks.