File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Backing Method not Being Called Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Backing Method not Being Called" Watch "Backing Method not Being Called" New topic
Author

Backing Method not Being Called

John Storta Jr.
Greenhorn

Joined: Jul 26, 2009
Posts: 29
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

Joined: Jun 25, 2001
Posts: 16055
    
  21

You did embed the commandLink in an <h:form> I hope???


Customer surveys are for companies who didn't pay proper attention to begin with.
sujith Acharya
Ranch Hand

Joined: Dec 25, 2006
Posts: 60
also have you checked the faces-config.xml for backing bean declaration?
John Storta Jr.
Greenhorn

Joined: Jul 26, 2009
Posts: 29
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

Joined: Nov 27, 2008
Posts: 101

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

Joined: Nov 27, 2008
Posts: 101

Or if you can use apache's myfaces..use <t:dataTable and set the preserveDataModel = "true". This also works fine.>
John Storta Jr.
Greenhorn

Joined: Jul 26, 2009
Posts: 29
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Backing Method not Being Called