> -----Original Message-----
> From: Vipul Sagare [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 17, 2002 11:45 AM
> To: Struts Users Mailing List
> Subject: Newbie Questions
>
>
> Do I have to have a separate ActionForm bean for every HTML form?

No, the ActionForms are specified as:
<form-bean name="whatever"...

and you use them with:
<action    path="/someUrl"
               type="my.action.class.SomethingAction"
               name="whatever"
              scope="request"
              input="logon">
      <forward name="success"  path="/somepage.jsp"/>
</action>

You can create another action and use the "whatever" form again.



> Can I use other beans or hashmaps with ActionForms?
>

You can use any object you want, as long as the accessors follow standard
JavaBeans pattern.
Keep in mind what Craig says about needing to redisplay incorrectly entered
data from the users end.  If a user types in 22 for their age, struts can
set 22 in a nested object that requires an int, long, or wrapper of either.
But if the user enters 'twenty two', then it will not be added and if you
are validating it, when the page gets redisplayed, it won't say 'twenty
two', it will just be blank, or you might have a nice stack trace for them
to look at.

Search the archives, this is a pretty regular topic.

James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://www.open-tools.org/struts-atlanta



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

Reply via email to