You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Antonio <an...@gmail.com> on 2008/10/22 17:16:38 UTC

Re: More html:form TAG in one page for struts 1

2008/10/22 D'Ottavio Alessandro <al...@elsagdatamat.com>:
> I have one page and one FormBean that is populated by the form but I
> would like have 2 FormBean and 2 form associated at the same page

Are you going to use 1 or 2 actions?
Because you can associate only 1 form bean to 1 action, but the same
form bean can be associated to more than one action.

Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: R: More html:form TAG in one page for struts 1

Posted by Antonio <an...@gmail.com>.
2008/10/22 D'Ottavio Alessandro <al...@elsagdatamat.com>:
> if I create the FormBeanA associate with the ActionA (specific
> properties with getter and setter and validate specific only for that
> properties requested by function A need) struts automatically will
> valorised the bean using the setter present...
> and the same will be done for the Action B with the associated FormBeanB
>
> this will solve the problem of the validation and mean that I can use
> more html:form tag associate at the same page because the submit will
> request one specific action and the ActionServlet will populated the
> specific Bean

OK.

>
>
> But in this way I have another problem :)
>
> When I populate the FormA and I submit, the result could populate the
> filed of the FormB.
> That mean that when I submit the function A I should put manually in the
> request also the FormB FormBean?

When you submit a form, only that form will be populated, the other
one in the page won't. This is related to HTTP (when you press
"submit" of a form, only the fields of that form are submitted) not to
Struts.

> Struts will understand automatically that there is that bean?
> Actually the framework automatically will populate formA with BeanA
> because is in the action activated, but for the formB and BeanB?

If you reason in terms of HTTP requests everything becomes clear: each
field is translated into HTTP parameters, each form name (or "id") is
translated into the name of the form bean, each action (of <form> tag)
is translated into a Struts action.
This way, you can see that the two forms are completely independent,
so Struts won't get confused.
What you can do is mixing up fields: you cannot submit a field that
belongs to another form.

Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: More html:form TAG in one page for struts 1

Posted by "Kawczynski, David" <da...@merck.com>.
If the functionality provided by the 2 different classes is similar:  
You could use a dispatchaction instead of two different Action 
classes.  Just give the submit buttons different values.  

EG:
<input type="submit" name="submit" value="add"/>
<input type="submit" name="submit" value="delete"/>

Public MyDispatchAction extends DispatchAction {
	void dispatchMethod(mapping, form, request, response, name) {
		name = nameform.getSubmit().trim();
		super(mapping, form, request, response, name);

	}
	ActionForward add(mapping, form, request, response) {
		...
	}
	ActionForward delete(mapping, form, request, response) {
	...
	}
}


-----Original Message-----
From: D'Ottavio Alessandro [mailto:alessandro.dottavio@elsagdatamat.com]

Sent: Wednesday, October 22, 2008 11:47 AM
To: Struts Users Mailing List
Subject: R: More html:form TAG in one page for struts 1



Ciao Antonio,

Actually I'm using 2 different actions and in both the action I have
associated the same formBean, but you gave me one idea:

if I create the FormBeanA associate with the ActionA (specific
properties with getter and setter and validate specific only for that
properties requested by function A need) struts automatically will
valorised the bean using the setter present...
and the same will be done for the Action B with the associated FormBeanB

this will solve the problem of the validation and mean that I can use
more html:form tag associate at the same page because the submit will
request one specific action and the ActionServlet will populated the
specific Bean


But in this way I have another problem :)

When I populate the FormA and I submit, the result could populate the
filed of the FormB.  
That mean that when I submit the function A I should put manually in the
request also the FormB FormBean?

Struts will understand automatically that there is that bean? 
Actually the framework automatically will populate formA with BeanA
because is in the action activated, but for the formB and BeanB?

Or is there another way to populate the fields of one form that is not
using the FormBean properties?

Thanks



2008/10/22 D'Ottavio Alessandro <al...@elsagdatamat.com>:
> I have one page and one FormBean that is populated by the form but I
> would like have 2 FormBean and 2 form associated at the same page

Are you going to use 1 or 2 actions?
Because you can associate only 1 form bean to 1 action, but the same
form bean can be associated to more than one action.

Antonio
Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or
MSD and in Japan, as Banyu - direct contact information for affiliates is
available at http://www.merck.com/contact/contacts.html) that may be
confidential, proprietary copyrighted and/or legally privileged. It is
intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this
message in error, please notify us immediately by reply e-mail and
then delete it from your system.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


R: More html:form TAG in one page for struts 1

Posted by D'Ottavio Alessandro <al...@elsagdatamat.com>.

Ciao Antonio,

Actually I'm using 2 different actions and in both the action I have
associated the same formBean, but you gave me one idea:

if I create the FormBeanA associate with the ActionA (specific
properties with getter and setter and validate specific only for that
properties requested by function A need) struts automatically will
valorised the bean using the setter present...
and the same will be done for the Action B with the associated FormBeanB

this will solve the problem of the validation and mean that I can use
more html:form tag associate at the same page because the submit will
request one specific action and the ActionServlet will populated the
specific Bean


But in this way I have another problem :)

When I populate the FormA and I submit, the result could populate the
filed of the FormB.  
That mean that when I submit the function A I should put manually in the
request also the FormB FormBean?

Struts will understand automatically that there is that bean? 
Actually the framework automatically will populate formA with BeanA
because is in the action activated, but for the formB and BeanB?

Or is there another way to populate the fields of one form that is not
using the FormBean properties?

Thanks



2008/10/22 D'Ottavio Alessandro <al...@elsagdatamat.com>:
> I have one page and one FormBean that is populated by the form but I
> would like have 2 FormBean and 2 form associated at the same page

Are you going to use 1 or 2 actions?
Because you can associate only 1 form bean to 1 action, but the same
form bean can be associated to more than one action.

Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



"Questo messaggio ed ogni suo allegato sono confidenziali e possono essere riservati o, comunque, protetti dall'essere diffusi. Se il ricevente non � il destinatario diretto del presente messaggio, � pregato di contattare l'originario mittente e di cancellare questo messaggio ed ogni suo allegato dal sistema di posta. Se il ricevente non � il destinatario diretto del presente messaggio, sono vietati l'uso, la riproduzione e la stampa di questo messaggio e di ogni suo allegato, nonch� la diffusione del loro contenuto a qualsiasi altro soggetto"
*****
"This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the intended recipient, please contact the sender and delete this message and any attachment from your system. If you are not the intended recipient you must not use, copy or print this message or attachment or disclose the contents to any other person."

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org