aspose file tools*
The moose likes JSF and the fly likes Row Actions on DataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Row Actions on DataTable" Watch "Row Actions on DataTable" New topic
Author

Row Actions on DataTable

Mike Dingham
Greenhorn

Joined: Oct 06, 2006
Posts: 8
Hi,

I apologize for reposting same issue. But I think I narrowed it down.

I have a "hataTable" with an "h:actionLink" per each row.
My managed bean is in request scope (Holding datamodel for the datatable)
When I click on actionLink it does not fire action on the managedbean.

The reason I found is

"During RestoreView stage JSF Validates DataModel from client
against the one in managed bean! Since my managedbean is stored at
request scope level, it does not have this list yet. So It does not fire
this event."

To workaround this problem I had to store the managedbean at
SessionScope.

But this does not simple to be a good solution...I have lot of lists
in my application;

Please let me know your suggestions....

Thanks,
Mike
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
I've seen lots of ppl having this problem, but I really don't understand why they have. UICommand elements in UIData tables have always worked here.

Here is an basic example which just works here:

JSF

MyBean, request scoped

Where MyData is just an DTO with the fields Long id, String name and String value.

Try if this basic example works in your case too, then the problem prolly lies somewhere else.

[ October 08, 2006: Message edited by: Bauke Scholtz ]
[ October 09, 2006: Message edited by: B L Scholtz ]
Mike Dingham
Greenhorn

Joined: Oct 06, 2006
Posts: 8
Thanks for the response...

The example you have given works.. Because it is a static list.

But in my case, I am building list from database.
And I retrieve it only in a action which is invoked during
INVOKE_APPLICATION stage.

But during APPLY_REQUEST_VALUES stage JSF is trying to compare
dataModel already sent to client with dataModel of managed bean, which is
null at this point. So it is not firing action on managed bean.

I wish there is some component which does not validate dataModels..

Thanks,
Mike
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Isn't this sufficient?
Jenifer Rajakumar
Ranch Hand

Joined: Oct 31, 2013
Posts: 34
Hi

Iam also in same issue, i have followed your example but, it is not working. If you have solved this error can you please share with me. Iam working on this issue nearly 3 days, iam developing alone So please guide me.

Error:




Same code you have given above, DTO Class

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

I see a "MyData" class, but what defines "myBean"?


Customer surveys are for companies who didn't pay proper attention to begin with.
Jenifer Rajakumar
Ranch Hand

Joined: Oct 31, 2013
Posts: 34
My Bean

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

You need to tell JSF that MyBean is a JSF Model bean (Managed Bean). You can do this (in JSF2) using the "@ManagedBean" property or you can define it as a Managed Bean in faces-config.xml

Like so:



Note that Request Scope is virtually useless in JSF. View Scope (in JSF2) or Session Scope are more practical for most uses. However, objects at these scope levels need to be serializable.
Jenifer Rajakumar
Ranch Hand

Joined: Oct 31, 2013
Posts: 34
Hi

Now it was working, Next i want to give some input field in my datatable if i gave name 1, name1 data wants to display in data-table give some guide.

xhtml



MyBean


It is correct?, Please check and guide me. Iam not getting output. please guide me
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Row Actions on DataTable