• 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

Dialog inside Datatable with button displays wrong variable value

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a bookings table where customers can view their bookings and in the table there is a button with a command button that onclick goes to the dialogue to display the variable petUpdate value but if you have 2 bookings then all the update buttons display the value of the last petUpdate in the arrayList can anyone help with this thanks

DataTable with the button


Code in the above datatable.......The commented out output label displays the correct value for each but when the button is clicked the dialog only displays the last ones value
 
Saloon Keeper
Posts: 27752
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 should not attempt to define a dialog within a form control such as a dataTable. Define a separate form for the dialog (for maximum IE compatability, define it first).

Forms may not be embedded, either the original HTML version or the JSF version.

Also, this is not proper JSF EL usage:



A value attribute is supposed to reference a property,, not invoke a method. The proper coding would be:



Which would allow JSF to invoke getPetUpdate() for you.

The other way is bad practice for output, but it would be fatal for input controls, since it allows no way of invoking the corresponding setPetUpdate method when the form is submitted. JSF knows whether to call the get or set method when you do a proper property reference.
 
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic