Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to submit datatable

 
Rahul Shivsharan
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I bind my h:datatable from UI to my Backingbean.
So i'm populating datatable from backingbean

This is my backingbean

StudentBean.java




This is my Jsp

DatatablePractise.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
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic