Meaningless Drivel is fun!*
The moose likes JSF and the fly likes boolean property in dataTable 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 "boolean property in dataTable" Watch "boolean property in dataTable" New topic
Author

boolean property in dataTable

Henrique Sousa
Ranch Hand

Joined: Apr 29, 2004
Posts: 92
Hi folks,

I am new to JSF, so take it easy ok? After a lot of thinking, tips and checking out threads like this one approaching a similar situation, I have this scenario:
I have a managed bean named PersonNav used to navigate in session scope. It stores a list of objects which I display with a dataTable. Each object of the list has a 'selected' property (boolean), which is rendered with selectBooleanCheckbox. My intention is to modify this property by selecting the checkbox and invoking an action in the same session-scoped PersonNav bean.
The dataTable and commandLink look like this:

The action is executed, but the list is always empty. Looks like PersonNav is re-instantiated or something. Any ideas of how to tackle this down?
Thanks


Henrique Sousa<br />SCJP 1.4<br /> <br />All men die, not all men really live - Braveheart, 1995
Henrique Sousa
Ranch Hand

Joined: Apr 29, 2004
Posts: 92
Update:
PersonNav is the same instance in both calls (found out using Object.toString() implementation). Now I am really puzzled about the disappearance of 'list'. There is no setter for it (just getter), and the only place where it is instantiated is not executed. Any thoughts?

Update 2:
Although it seems to be the same instance, the constructor of PersonNav is called before each action performed on it (and it has always the same object id). Could it be something related to serialization of the object when it is retrieved from the session?
[ May 11, 2005: Message edited by: Henrique Sousa ]
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
By any chance your application running in a distributed environment?


- Varun
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Originally posted by Henrique Sousa:
There is no setter for it (just getter), and the only place where it is instantiated is not executed. Any thoughts?


Create one setter too.
Henrique Sousa
Ranch Hand

Joined: Apr 29, 2004
Posts: 92
I am running everything locally. I just realized I had a filter invalidating the session on every request. Now everything works, thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: boolean property in dataTable
 
Similar Threads
Sorting in h:dataTable
Input row select on data table does not get called
Loading DB data when web app context initialized
JSF datatable doubt
How to determine which dataTable row was selected