• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

<h:commandLink> is not able to invoke backing bean method

 
Pawan Komaram
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

The <h:commandLink> inside the <h:dataTable> is not able to invoke the backing bean method. Can Anybody suggest the solution?


 
Tim Holloway
Saloon Keeper
Posts: 18300
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A number of things can cause this. The first, and most obvious would be if you didn't have a "public String showProfile()" method in the backing bean.

The second most common reason would be if you had form inputs that failed to validate, but I don't see any input elements in your example, so in theory that isn't it.

It's often helpful to put a "h:messages" tag with the global option set on the page.
 
Pawan Komaram
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim!!!


I found the solution for this issue.....As I have used the <h:commandLink> inside a <h:dataTable> tag, whenever I click on the link, it tries to check the list variable of my backing bean whether it has the data or not, as my backing bean's scope is request, it couldn't take the list data to subsequent request, hence causing the problem. So the list variable must be initialized in the constructor, so that it can call the backing bean method. It happens when we use the commandLink inside a dataTable or any other looping tag.

This is actually a defect in jsf 1.2, they have fixed it in the jsf 2.0
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic