struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject [s1,validation] Multi-page flow, session-scoped DynaValidatorForm with checkbox
Date Fri, 17 Jun 2011 19:33:22 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

All,

I can't believe I've been working with Struts for nearly 10 years and
I'm only now attempting to use a multi-page flow with a form bean in the
session.

Of course, I'm having difficulty with checkboxes.

Our (simplified) flow looks something like this:

P1 -> A1 ---> P2 -> A2 ---> Done

"P1" contains a checkbox called "emailNotification". The bean is defined
with a <form-property name="emailNotification" type="java.lang.String" />

The "Done" page would like to use the value of that form property to
decide (you guessed it) whether or not to notify someone via email.

The problem is that if we check the box and submit to A2 (then show P2),
then go back (either browser-BACK or using our "previous" button in the
flow), then re-submit to A2, the form property in the bean stays set to
"true" (or whatever value we're using).

I've been looking at the "reset" attribute of the <form-property>
element in struts-config.xml and, at first glance, it looks promising.

Reading the code, however, it looks like setting reset="true" will end
up re-setting the form property to null (or blank string) upon every
request, meaning that my multi-page flow will have to repeat that form
element on every page.

I would have figured that DynaValidatorBean would be sensitive to the
current "page" of the flow and only reset properties with a page number
at or higher than the currently-being-submitted page (if you ignore the
chicken-in-the-egg problem of inspecting the request before resetting
the form before ... inspecting the request).

Is my analysis above correct?

What is the recommended technique when dealing with multi-page,
session-scoped dynamic forms?

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk37rAIACgkQ9CaO5/Lv0PALZgCfbeXZ8UD/IAPB+trVyUUUFp3u
aBsAoJBcDSGvaTP9i5KVh5XUOOVCkbk0
=boCA
-----END PGP SIGNATURE-----

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


Mime
View raw message