This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes Problem with f:attribute tag, new to JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem with f:attribute tag, new to JSF" Watch "Problem with f:attribute tag, new to JSF" New topic
Author

Problem with f:attribute tag, new to JSF

Johnny Caimbridge
Greenhorn

Joined: Nov 15, 2010
Posts: 8
NOTE: Before I begin, I just want to warn that I'm using a nonstandard tag "hx:dataIterator" ( http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?topic=/com.ibm.etools.jsf.doc/topics/rjsfdataIterator.html ), as this is the only way I could figure out how to achieve the desired functionality.

Hello,

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 "Lookup.java" (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)
COL_NAMEA | COL_NAMEB | COL_NAMEC
_________________________________
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)
COL_NAMEA | COL_NAMEB
______________________
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with f:attribute tag, new to JSF
 
Similar Threads
(URLyBird)How to mark a record to deleted one?
Traversing the table using arrow keys
get value on click from table using javascript
Passing Table values to action class
Listener event in a <f:ajax> tag doesn't get fired in the server side