aspose file tools*
The moose likes GWT and the fly likes How to load input textfields dynamically in my web page using Spring roo? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "How to load input textfields dynamically in my web page using Spring roo?" Watch "How to load input textfields dynamically in my web page using Spring roo?" New topic
Author

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

Denise Advincula
Ranch Hand

Joined: Jan 01, 2007
Posts: 160
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!


SCJP/OCPJP 6 | SCWCD/OCPJWCD 5 | OCMJEA in progress...
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10248
    
    8

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.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to load input textfields dynamically in my web page using Spring roo?