You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mallari Kulkarni <Ma...@TRIGYN.com> on 2001/02/23 13:37:41 UTC

more than one formclass for a one jsp ?

Hi,

I wanted to have more than one form class for   a  one jsp file.  Because in
my one jsp file,  i have a information of 4 tables. So i want to transfer
the information to 4  formclasses?  Is it possible?

Please help me.

Regards
Mallari



jCVS help!

Posted by soh syed <sy...@yahoo.com>.
 can any one help me with setting up jCVS for the
source control.

thanks

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Re: more than one formclass for a one jsp ?

Posted by Ted Husted <ne...@husted.com>.
You might want to clarify what you mean by form class. Struts offers a
base ActionForm class. This class is a JavaBean wrapper that works with
the HTML Form tag to automagically populate the fields on your form. It
also provides a built-in validation mechanism that works with the Struts
Action Class.

The ActionForm class for a HTML Form tag can be specified in the Struts
configuration file, or with the tag. There's not a way to specify more
than one ActionForm class in either of these places. Of course, you
could have more than one HTML form in your JSP, and associate different
ActionForm classes with each. Here, you would specify the ActionForm as
the "name" property to the Struts HTML form tag. 

I haven't tried it myself, but the form tags also accept a name
property, which may imply that you can use different ActionForm classes
for different fields.

Here's an answer to a different question: Can I use more than one entity
bean with my ActionForm beans?

Often, there is a one:one relationship between the ActionForm class and
an entity bean class that represents your table. However, you can now
nest other JavaBeans, of any class, within the ActionForm subclass. So,
a good way to go is to define a different entity bean classes for each
of your tables, and then encapsulate these within your ActionForm
subclass. 

See the Bean Developers guide 

<
http://jakarta.apache.org/struts/api/org/apache/struts/taglib/bean/package-summary.html#package_description
>

for more about the syntax for addressing nested properties. This syntax
also works for HTML tags.

> Mallari Kulkarni wrote:
> 
> Hi,
> 
> I wanted to have more than one form class for   a  one jsp file.
> Because in my one jsp file,  i have a information of 4 tables. So i
> want to transfer the information to 4  formclasses?  Is it possible?
> 
> Please help me.
> 
> Regards
> Mallari

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/

Re: more than one formclass for a one jsp ?

Posted by Jim Richards <gr...@cyber4.org>.
At 07:37 AM 23/02/01 -0500, you wrote: 

>
> Hi, 
>
> I wanted to have more than one form class for   a  one jsp file.  Because in
> my one jsp file,  i have a information of 4 tables. So i want to transfer the
> information to 4  formclasses?  Is it possible?


If what I think you are doing is wanting to have the four form classes
handle all the data from a form in one go, no I don't think so. A form can
only have one action attribute, so there's no way to split the data appart.

You can have four forms within the jsp page, and each one has it's own action, 
but only one can be used at a time. You won't be able to submit to all four at
once.


--
Kumera - a new Open Source Content Management System
for small to medium web sites written in Perl and using XML
http://www.cyber4.org/kumera/index.html