Hi Michael ,
I started off with using the same forms .. But down the line , it so
happens that the Screens might change ..
Eg If you have same form for Add and Modify , and then later in Modify
Screen you have only certain fields to be modified , then the problem comes
.
This happens when you use BeanUtils to copy properties from form to VO . In
that case,BeanUtils would throw errors as it wont be able to conert empty
Strings to date or what ever .
So I feel , its better to have different forms ..
Though that may mot be true always ..
Nimish
-----Original Message-----
From: Michael Cardon [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 06, 2003 9:05 PM
To: [EMAIL PROTECTED]
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]