This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Backing Method not Being Called

 
John Storta Jr.
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSF form to update some information in a database. I have a backing bean with a method associated with a commandLink action.

Below are what I think are the relevant sections of code and I can provide more information if it would help.

From the JSF page


The above prints a table with the names. Each row gets a Delete link that is associated with the deleteMember method in the backing bean

From the backing bean


When this method is called, it gets the data from the current row and then deletes that record from the database. It then updates the list of names.

The problem is that when the link is clicked containing the action to call the deleteMember method, the page refreshes, but that is it. I have all of those System.out calls because I was trying to see where it was failing, but not even the first one prints so I must presume the method is not even being called.


I have other pages and backing beans that are working fine. I am thinking I have a typo somewhere, but I am at a loss to find it.

Does anything in what I posted look amiss to anyone, or does anyone have any thoughts I where I should be looking?


Thanks,
John S.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You did embed the commandLink in an <h:form> I hope???
 
sujith Acharya
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also have you checked the faces-config.xml for backing bean declaration?
 
John Storta Jr.
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code is inside an <h:form> and the bean is declared in faces-config.xml.

This is actually just one part of the form. There is also a link to add a new name to the list. That works just fine. It calls the method in the backing bean, updates the database with the new name and refreshes the page so the dataTable includes the new name.

The delete link is the only part that does not work.

I am going to strip out this section and create a smaller test page and see what happens. Then I will add the other components to it and see if that helps me isolate where it breaks.


Thanks,
John S.
 
Shasi Mitra
Ranch Hand
Posts: 101
Flex Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you put the same command link outside the datatable it works rite? Is your backing bean in request scope? Try putting that in session..It'll work..
 
Shasi Mitra
Ranch Hand
Posts: 101
Flex Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or if you can use apache's myfaces..use <t:dataTable and set the preserveDataModel = "true". This also works fine.>
 
John Storta Jr.
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shasi,
I think you are on to something. I had recently changed my backing beans to be request scope because another part of this was not refreshing after updates. I thought for sure this part was working before I made that change, but then convinced myself that maybe it never worked.

Based on your comment, I think I am either going to look at doing this a different way or use myfaces.


Thanks,
John S.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic