struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Heather Buch" <hb...@www.thebuchs.dk>
Subject where does a form element get and put it's data
Date Tue, 01 Jul 2003 10:28:22 GMT
I know the Struts form bean raises a lot of discussion. Personally, form beans
cause me a lot of confusion too, maybe not in the same way that they confuse
others, but maybe so. I'll attempt to explain.

I feel like it is not consistent whether a form bean is first used upon
creating, or submitting a form.

Basically, my Action classes fall into two general categories:

1. "list" action classes which get data from my database and put it into a form.
2. "save" action classes which take data from the form and write to the db.

As far as I am concerned, this is how use of a form bean makes sense to me:

1. user requests a form
2. "list" action executes and saves some database data into a the session or
request.
3. user fills out and submits form
4. form bean collects data
5. "save" action executes and gets data out of form bean

But sometimes I feel like struts intends for me to use a form bean like this:

1. user requests a form
2. "list" action executes and saves some database data into a the session or
request.
3. "list" action creates a form bean and puts data into it (I don't like this.
I don't want to see my form bean until after form is submitted)
4. user fills out and submits form
5. form bean collects data
6. "save" action executes and gets data out of form bean

I cannot understand how some of the jsp tags work vis a vis form beans.

For example, if, in a "list" action, I make a list of beans of database
information and set that list in the session, I can then use the "html:select"
tag to retrieve data from the bean I have set in the session, and write it to
the form bean. This makes sense.

However, if I want to use a prepopulated radio button, then, in my "list"
action I have to get data from the database and put it in my *form bean*.
Based on what I understand, the html:radio "property" attribute will only
prepopulate the radio button if the information retrieved from the *form bean*
via "property" matches the "value" attribute of html:radio. But I do not want
to *retrieve* infromation from my form bean when I display my form. I want to
retrieve information from the bean that my "list" action has saved in the
session. I only want to retrieve information from my form bean during my
"save" action. 

so it seems like the flow of information from database to form bean and then
to action is kind of inconsistent. I hope this makes sense. If  you need some
examples, let me know and I'll try to create them.

Best,

Heather Buch



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message