File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Not able to submit datatable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Not able to submit datatable" Watch "Not able to submit datatable" New topic

Not able to submit datatable

Rahul Shivsharan
Ranch Hand

Joined: Jun 17, 2009
Posts: 83
I bind my h:datatable from UI to my Backingbean.
So i'm populating datatable from backingbean

This is my backingbean

This is my Jsp


Now, my problem is , i'm not able to Submit my collection back to my server

I saw the JSF 1.2 doc , there is no method in HtmlDatatable which gets data

I saw UIData, but here there is only method to get selected rows from UI

can anybody help me out or atleast give me a hint

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

I'm afraid that your example is so long that I can't read it. However, in all the years I've worked with JSF, there's only been one app I've written that built up a dataTable in Java code, and that one is a generic table editing app when the columns vary depending on which table is being edited. It's far, far, easier to code XML in the View as long as the table format is static.

In any event, JSF does not "submit a datatable". What actually happens is that the input controls within the dataTable display are scanned when you fire a command, and their values are sent to the FacesServlet, from whence they go through the JSF controllers and are posted to the DataModel that backs the dataTable. In other words, the rows in the wrapped data of the DataModel are directly updated by the controllers with the data control values from the submitted form. This is true whether you use the XML definitions or do brute-force creation of the UIComponent subtree in raw Java code.

The caveat on this is that since the backing data rows are updated, they cannot come from a read-only data source. In other words, you can't use a jdbc DataModel; you must use something such as a List- or ArrayDataModel.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Not able to submit datatable
It's not a secret anymore!