Let's assume three pages that you need capture info. Build three objects that represent that page data you need to capture (A_Pojo, B_Pojo, C_Pojo) and stuff them into one master POJO - BigMomma.
I'd then add BigMomma to your ActionForm and use this ActionForm for all three pages.
Then on each page your hidden vars would look like....
bigMomma.aPojo.someProperty
bigMomma.cPojo.fooBarProperty
etc.
When the form submits in your Action you could then stuff the whole ActionForm back into the request again. The benefit to this is all you need to maintain then is hidden form fields on the front end. You don't have to worry that much about pushing the right stuff into the request from your Actions. This is nice if you end up needing to add or remove pages etc. You only have to worry about maintaining the front end jsps. You could actually reuse one action class who's job is to just stuff the ActionForm back into the request each time. Basically your 'wizard' pages would all just use one ActionForm and one Action class. Pretty clean I think.
On the final step you can just pull the bigMomma bean out of the ActionForm and send it to your persistence layer. The final step call would be to a different Action or, since I like to use Dispatch Actions (Yes, my name is Rick I use the DispatchAction:), you could just have a lastStep() method or whatever you want to call it in there that calls your backend stuff.
Brian McGovern wrote the following on 4/4/2005 2:01 PM:
I think i have a fundemental misunderstanding of ActionForms not having used them that much. So forget everything i said about ActionForms, i was wrong. I still dont like em partially cause im stubborn, but also because i dont like that you have to define you whole form in your struts config. Im gonna have alot of forms in my app but none of them are used in more than 1 screen. Seems like an implementation detail and not a configuration issue.
Whatever. The crux of this thread really can be summed up in "At what point does using session cease being a good practice and become a lazy man's shortcut." And i think woodchuck is 100% right, there is no correct answer. Small apps or lightly used apps can use the session for just about anything whereas larger apps or heavy hit apps really should not use it much at all.
To answer some of woodchuks q's though, Im using struts to delegate control flow, access resource bundles and things like that. I started out using other struts logic and bean tags but went with jstl after reading thats what apache recommends now. The app will be fairly large, and entirely behind ssl. I dont really so much care about people viewing source for these forms, this data is not CC numbers or SSNs or anything. The hidden fields i will be sending back will account for probalby 1/20th of the entire pages' source code so there is no issue with repsonse time here. My main reason for staying away from the session here is because the app im writing is a startup site that has an unknown but potentially enormous user base who will be marketed to in period campains. I have no idea how many users will be on the site filling out these forms at any given time but we will be marketing it to thousands at any given time, so i need to prepare for huge load even though i ma
y never see it.
-- Rick
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]