> form bean only under the form bean's name. That may or may not be a big
> deal to your current app, but I'd suggest using getAttribute() instead to
> protect yourself against future changes (such as, for example, having
> multiple actions that want to use the same form bean in session scope, but
> under different attribute names).
thanks craig, now I got it : ) the docs are not very clear regard to parameter use. The "Structs in Action" explain it as you did (just found it now:)).
Craig R. McClanahan wrote:
On Mon, 18 Aug 2003, Emerson Cargnin wrote:
Date: Mon, 18 Aug 2003 19:10:57 -0300 From: Emerson Cargnin <[EMAIL PROTECTED]> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: "attribute" and "name" attributes of ActionMapping
In the struts-example application, the LogonAction uses the "attribute" attribute to read or delete the formBean
eg : session.removeAttribute(mapping.getAttribute());
If "attribute" is not used (just the name), is it possible to use the same approache? is it a good technic?
If you look at the implementation of the getAttribute() method in ActionForm, you'll see that it uses the form name if you don't explicitly reference something else. Therefore, using getAttribute() instead of getName() gives you the *option* to store the form bean under an attribute different than the form bean name, without having to worry about whether or not a particular Action really uses this.
If you use mapping.getName() all the time, you're stuck with storing the form bean only under the form bean's name. That may or may not be a big deal to your current app, but I'd suggest using getAttribute() instead to protect yourself against future changes (such as, for example, having multiple actions that want to use the same form bean in session scope, but under different attribute names).
Craig
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Emerson Cargnin Analista de Sistemas Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]