You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sven Frederik Pohl <sv...@cmg.com> on 2002/11/27 16:08:42 UTC

session constants in ActionForms and the reset-Method

Hi all,

i wondered if ActionForms are practical to store some constant session data, that is to be presented to the user but which must not be modified by the user. Concretely, I got some forms in which certain fields are constant (output only fields) in the case that the values were already entered in a form that have been submitted earlier. I think of this because I dont want to care about these distinct of cases in JSP, form.validate and action. i would like to implement it only once.

An approch that seemed logical to me, is a session scope form bean that has some values that can be set to constant, so that the user won't be able to edit their values in the form.

The ActionForm.reset method is called every time before its values are repopulated by the submitted HTML-form (so the HTTP-request). So the reset-Method should not reset these constant values. So it only works, if it is garanteed for a session form bean that it is not used by any other session, even if the owning session has been destroyed. Is that true?

Any other ideas or solutions? Any comments?
My goal is not to write the code for the distinction multiple (3!) times which bothers me...

Thanks in advance,
Sven Pohl


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>