Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Denise Advincula
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • 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!
Maneesh Godbole
Posts: 11445
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • 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.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!