• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Submit dataTable fields

 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 https://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?
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@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
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your time. I will go for it.
 
Look! I laid an egg! Why does it smell like that? Tiny ad, does this smell weird to you?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic