prain
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.aData Item1}"
actionListener="#{dataMana ger.goToCl ickedLink1 ()}"/>
</td>
</tr>
<tr>
<td >
<p:commandLink
value="#{dataManager.aData Item2}"
actionListener="#{dataMana ger.goToCl ickedLink2 ()}"/>
</td>
</tr>
<tr>
<td >
<p:commandLink
value="#{dataManager.aData Item3}"
actionListener="#{dataMana ger.goToCl ickedLink3 ()}"/>
</td>
</tr>
<tr>
<td >
<p:commandLink value="more"
actionListener="#{dataMana ger.goToCl ickedMore( )}"/>
</td>
</tr>
</tbody>
</table>
</ui:composition>
</html>
@ManagedBean(name="DataMan ager")
@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("Clicke d goToClickedLink1");
aDataItem3 = "Hello World P";
}
public void goToClickedLink2()
{
System.out.println("Clicke d goToClickedLink2");
aDataItem2 = "Hello World Q";
}
public void goToClickedLink3()
{
System.out.println("Clicke d goToClickedLink3");
aDataItem3 = "Hello World R";
}
public void goToClickedMore()
{
System.out.println("Clicke d goToClickedMore");
aDataItem3 = "asjkfdhgsakjhdfkjashfd";
}
}
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.aData
actionListener="#{dataMana
</td>
</tr>
<tr>
<td >
<p:commandLink
value="#{dataManager.aData
actionListener="#{dataMana
</td>
</tr>
<tr>
<td >
<p:commandLink
value="#{dataManager.aData
actionListener="#{dataMana
</td>
</tr>
<tr>
<td >
<p:commandLink value="more"
actionListener="#{dataMana
</td>
</tr>
</tbody>
</table>
</ui:composition>
</html>
@ManagedBean(name="DataMan
@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("Clicke
aDataItem3 = "Hello World P";
}
public void goToClickedLink2()
{
System.out.println("Clicke
aDataItem2 = "Hello World Q";
}
public void goToClickedLink3()
{
System.out.println("Clicke
aDataItem3 = "Hello World R";
}
public void goToClickedMore()
{
System.out.println("Clicke
aDataItem3 = "asjkfdhgsakjhdfkjashfd";
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Your welcome, glad I could help! :)
ASKER
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.