Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Problem with f:attribute tag, new to JSF

Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NOTE: Before I begin, I just want to warn that I'm using a nonstandard tag "hx:dataIterator" ( ), as this is the only way I could figure out how to achieve the desired functionality.


I am new to JSF and I'm having a problem with the attribute tag.

I'm trying to dynamically display a set of database tables with delete buttons adjacent to each row each table. The problem I'm having is in "relaying" to the pagecode the row deleted (and the table from which the row has been deleted) with the <f:attribute> tag:

Then, in the pagecode "" (which is in request scope; this request scope pagecode references the session scope instance "controller", but that is not shown here):

The problem becomes apparent when I print out the result of these two "toString()" calls: What happens is that while the "tableOfRowDeleted" correctly contains a reference to the instance associated with the table from which the user pressed the delete button on (which is the expected behavior), the "rowDeleted" reference is wrong ("wrong" as in this is not what I intended): instead, "rowDeleted"--regardless of what table the user pressed the delete button on--contains a reference to a RowEntry associated with the last table displayed in the resulting HTML page and of the same row offset (into the table).

For example, if the above code displayed two tables as follows:

(table 1)
ROW0 COLA | ROW0 COLB | ROW0 COLC (delete button)
ROW1 COLA | ROW1 COLB | ROW1 COLC (delete button) <--- A (this button is pressed)
ROW2 COLA | ROW2 COLB | ROW2 COLC (delete button)

(table 2)
ROW0 COLA | ROW0 COLB (delete button)
ROW1 COLA | ROW1 COLB (delete button) <--- B (but the underlying reference which this row represents is erroneously retrieved in the page code)

If the user presses the delete button adjacent to the second row of the first table (labeled "A" above), then when the "doBtnInitDeleteRow()" function is executed, "rowDeleted" does not contain a reference to table 1's second row (as I would expect). Instead, "rowDeleted" contains a reference to the second row of table 2 (labeled "B" above). It so happens that in any combination of tables which I choose to display with this code, the RowEntry reference retrieved in the pagecode associated with the delete button is always associated with the last table displayed in the HTML.

Thanks for your help in advance. If this appears to be an issue with the usage of that non-standard tag (and not general JSF issue), then let me know and I'll seek help from IBM instead.
Well THAT's new! Comfort me, reliable tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic