• 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

How to load input textfields dynamically in my web page using Spring roo?

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys!

I'm very new with spring roo. I managed to convert my Spring Roo to GWT, and did some CRUD stuffs through the tutorials provided. However, I got stuck with this problem:

1) I have defined fields that I should retrieve from the DB (e.g. Username, Employee Number, etc..)
2) I want to load these fields in the UI of my web app dynamically:

2.1) Retrieve the fields from the DB
2.2) Iterate them
2.3) Show them in my page as "Label of the Field <e.g. Username>" : <Input Textfield>

3) The client user can then enter values and save them somewhere.

These are my entities, generated via Spring roo:



And the transaction entity that's supposed to store my dynamic fields


I am kinda lost on where/what to begin. Hope your expertise can help me. Thank you in advance!
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Disclaimer: I dont work on Roo. My opinion is purely from a programming perspective

Decide what kind of visual layout you need for the fields. Consider the fact that the number of fields is not know. This will decide what container/parent/widget you should be using to display the fields.
Iterate over the Set. Extract individual MyField objects. Create and maintain another collection for the TextBox.
For every field object, add the label+TextBox to the UI. Dont forget to add the TextBox to the collection too.
Repeat for all objects in your set.

For saving, the index of the TextBox in its collection will correspond to the index of the MyField in the Set.
Get the user vales from the TextBox, invoke getter on MyField. Repeat for all TextBox instances.
Now your set contains MyField objects with updated values.
Process as required.
 
reply
    Bookmark Topic Watch Topic
  • New Topic