• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Backing Method not Being Called

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You did embed the commandLink in an <h:form> I hope???
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 101
Spring Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Spring Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic