Hello
it totally depends what you need.

different names:
if u use different names than there will be created five different forms,
each under an other name.
if all are in request it makes not really sense to do this because they are
deleted if the request is over.

but if you use them in session then it could make sense
then you could have up to five formbeans in scope and get to their values
every time, but you have to know which form you actually need
if they are stored under the same name then only once is created the
formbean so values will be availble for every action which uses it
(except you explicite destroy it)

Michael

----- Original Message -----
From: "Michael Cardon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 06, 2003 4:35 PM
Subject: Best Practices in Struts for Form objects?


> Hello,
>
> If I have 5 Action classes that all need to reference the same Form
object,
> should I map each Action to the same form name, or use different names for
> each of the Forms in the Actions?  Does it make a difference if I'm using
> session scope vs. request scope?
>
> Example using the same form names, same form class:
>
> <form-bean name="pwForm" type="mim.struts.form.SelectForm"/>
>
>     <action    path="/teacherPw"
>                type="mim.struts.action.pw.StudentPwAction"
>                name="pwForm"
>               scope="request"
>            validate="false"
>           parameter="dispatch">
>       <forward name="success" path="mim.pw.list"/>
>     </action>
>
>     <action    path="/studentPw"
>                type="mim.struts.action.pw.StudentPwAction"
>                name="pwForm"
>               scope="request"
>            validate="false"
>           parameter="dispatch">
>       <forward name="success" path="mim.pw.list"/>
>     </action>
>
> ... 3 more actions ....
>
>
> Example using diferent form names, same form class:
>
> <form-bean name="teacherpwForm" type="mim.struts.form.SelectForm"/>
> <form-bean name="studentpwForm" type="mim.struts.form.SelectForm"/>
>
>     <action    path="/teacherPw"
>                type="mim.struts.action.pw.StudentPwAction"
>                name="teacherpwForm"
>               scope="request"
>            validate="false"
>           parameter="dispatch">
>       <forward name="success" path="mim.pw.list"/>
>     </action>
>
>     <action    path="/studentPw"
>                type="mim.struts.action.pw.StudentPwAction"
>                name="studentpwForm"
>               scope="request"
>            validate="false"
>           parameter="dispatch">
>       <forward name="success" path="mim.pw.list"/>
>     </action>
>
> ... 3 more actions ....
>
> Thanks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to