Meaningless Drivel is fun!*
The moose likes JSF and the fly likes Submit dataTable fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Submit dataTable fields" Watch "Submit dataTable fields" New topic
Author

Submit dataTable fields

Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Hello. I have a dataTable and I wish to submit the values.

But none of the dataTable values are submited, how should I do?

Would I have to write a dataTable instead of just giving the collection to the component? ( I saw this idea here http://www.coderanch.com/t/506763/JSF/java/multiple-selectOneMenu-values-inside-dataTable#2288586 )

I am using Primefaces with Mojara 2.04 and Glassfish.

Here it is the code of my dataTable:


Is there another way? Or I will have to the dataTable writed by myself?


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Christopher Whu
Ranch Hand

Joined: Sep 03, 2008
Posts: 80
i have a similar question
my table looks like


it works perfectly fine with the f:setPropertyActionListener tag but what if i wanted to pass a qty of the item to add that has to be obtained from the field...

sadly i dont think you can put multiple h:form tags w/in the same datatable...
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Hebert - you need a dataModel to decorate your row data with the cursor constructs needed to enumerate the rows in the table. That's why you can't bind the collection directly to the dataTable control.

Christopher - When you fire an action processor using a commandButton or commandLink on a row in a dataTable, you can find out which row was fired using the datamodel methods "getRowData()" and "getRowNumber()" - assuming I haven't remembered their names wrong. Again.

You can do forms inside a dataTable, but they have to obey standard XML tag/endtag matching rules. So you could wrap a form around a single column's items, for example. However, that's a bit much for most of us.


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

Joined: Jul 14, 2010
Posts: 754

@Tim Holloway
Thanks for you reply.

I googled trying to find some tutorial with dataModel and I could not find It, yet.

Do you have any tutorial? Or link to indicate?

Thanks! [=
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

It's an old series of articles, but it's still relevant, and it really helped me when I was getting started. Google IBM Developerworks series "JSF For Nonbelievers" by Rick Hightower. He has a good example of a table/detail application.
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Thanks for your time. I will go for it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Submit dataTable fields