• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Dynamically adding rows to an input data table

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys

Have a very elementary problem in my initial learning in JSF.
I intend to have a table on my form to capture rows of data and to bind them with corresponding Java variables.
The challenge I face is being able to add rows of fields to my table dynamically, as in:

If I am to capture data about a customer and his family the form might look like:

Name Age Ph No Relationship
Andrew Greene 47 09402934234 Self
Marie Greene 45 23234923800 Wife
Jake Greene 17 23948209840 Son

Now if I wish to add another member of the family on the form, I would probably have an add button that would generate another row of input fields in a row:

Anna Greene 16 23482304800 Daughter


I am wondering how it might be possible for me to keep adding rows for each member of the family on the form dynamically, without having to submit the form?

Would appreciate any help.

P.S.: Please pardon the elementary nature of my question, as I am yet at a very stage of exploring these topics.

It would be very helpful to know if there is a live chat option available (here or any other forum) to be able to interact with others from whom I can learn.








 
Saloon Keeper
Posts: 28745
211
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
If you do not submit the data, then the server will never see the new data. The submit process is the only way that client and server can communicate.

You can do a partial submit using AJAX, but it's still a submit and the rules are almost identical to a full-page submit.

Adding rows to a table is done by adding them to the Model that backs the table and re-rendering the table. The re-rendering can be done by doing a full-page submit (which will redraw the entire page) or a partial-page submit using AJAX,
 
Abbhinav Sharma
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim

Thanks for taking time to attend to my query.
Using AJAX sounds like an alternative I could certainly try. As I go about doing it, I will most likely have more questions, and I certainly know where to reach out for help

Further to my postscript, it would be very helpful to know of a live chat forum, where it would perhaps be possible to interact with adept progammers to seek help in clearing my concepts interactively.
I am still to come to grips with exactly how the flow of control works in JSF based applications i.e. a micro level understanding of when are instances actually created and how exactly the interactions with the server take place.

Would greatly appreciate any suggestions to help with that.

Thanks once again for the help.

Regards
Abhinav


 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic