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

asked on

p:commandLink value does not getting updated. This is frustrating

All,
I am having a series of p:commandLink components. Each one is linked to a bean function. Just for testing purposes, I want to see the link's text getting changed when clicking it as shown in the code below. On the browser the links do not changed when clicked. What is the problem here and what I am not doing right. Please help. This is the design I am expected to implenent in a actual system.



<ui:composition>
 
 
      <table role="region" aria-label="Key Services Portlet"
class="table">
            <tbody>
                  <tr>
                        <td >
                              <p:commandLink
value="#{dataManager.aDataItem1}"
actionListener="#{dataManager.goToClickedLink1()}"/>
                        </td>
                  </tr>
                  <tr>
                        <td >
                              <p:commandLink
value="#{dataManager.aDataItem2}"
actionListener="#{dataManager.goToClickedLink2()}"/>
                        </td>
                  </tr>
                  <tr>
                        <td >
                              <p:commandLink
value="#{dataManager.aDataItem3}"
actionListener="#{dataManager.goToClickedLink3()}"/>
                        </td>
                  </tr>
                  
                  <tr>
                        <td >
                              <p:commandLink value="more"
actionListener="#{dataManager.goToClickedMore()}"/>
                        </td>
                  </tr>
        </tbody>
      </table>
      
</ui:composition>
</html>





 

@ManagedBean(name="DataManager")
@SessionScoped
public class DataManager  {

      private List<String> list;
      private String aDataItem1 = "Employment Opportunity 1";
      private String aDataItem2 = "Employment Opportunity 2";
      private String aDataItem3 = "Employment Opportunity 3";
 
 
      public  DataManager()  {
             
               
      }

      
      
      public String getaDataItem1()
      {
            return aDataItem1;
      }
      
      public void setaDataItem1(String aValue)
      {
             
            aDataItem1 = aValue;
      }
      
      public String getaDataItem2()
      {
            return aDataItem2;
      }
      
      public void setaDataItem2(String aValue)
      {
             
            aDataItem2 = aValue;
      }
      
      public String getaDataItem3()
      {
            return aDataItem3;
      }
      
      public void setaDataItem3(String aValue)
      {
             
            aDataItem3 = aValue;
      }
      
      
      
      public void goToClickedLink1()
      {
            System.out.println("Clicked goToClickedLink1");
            aDataItem3 = "Hello World P";
      }
      
      
      public void goToClickedLink2()
      {
            System.out.println("Clicked goToClickedLink2");
            aDataItem2 = "Hello World Q";
      }
      
      public void goToClickedLink3()
      {
            System.out.println("Clicked goToClickedLink3");
            aDataItem3 = "Hello World R";
      }
      
      public void goToClickedMore()
      {
            System.out.println("Clicked goToClickedMore");
            aDataItem3 = "asjkfdhgsakjhdfkjashfd";
      }
}
ASKER CERTIFIED SOLUTION
Avatar of mccarl
mccarl
Flag of Australia 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

PERFECT!!!!
Thank You Very Much. Yes somehow I did not realize that the update property must be set. Phew, coming from ASP.NET background this is different. Thanks again.
Your welcome, glad I could help!  :)