You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nadja Senoucci <Na...@zmnh.uni-hamburg.de> on 2003/07/16 12:07:56 UTC

Question about the form tag

Hello everyone,

I have two or more forms on one page, but actually they are all the same
forms, just with different values in them (it's all about one hidden field
and a few checkboxes, really). Now, these forms all have the same
action-mapping, since they are basically the same. When I press a button
now, it doesn't recognize which form it belonged to and just takes the
first one... Is there a way to find out which form's button has been
pressed? I thought maybe giving the form a name would help but that doesn't
seem to be possible with the form tag...

Any ideas?

Greetings,
Nadja

---------------------------------------------------------------------
Nadja  Senoucci
Universitaet Hamburg
Zentrum für Molekulare Neurobiologie
Service-Gruppe EDV
Falkenried 94
20251 Hamburg
Germany
Tel.:040 - 428 - 03 - 6619
Fax.:040 - 428 - 03 - 6621


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


Re: Re[10]: Question about the form tag

Posted by Nadja Senoucci <Na...@zmnh.uni-hamburg.de>.
Hello Dirk,

>I set up a test jsp like above and I get values from form 2, if I
>click any button of form 2 (and vice versa). I guess either your
>struts-config or your action form is not correct.

Hmm... I guess, I will have to look into this some more tomorrow then. This
is really odd, because the form works fine if I only display one form and I
have logging information that tells me I do get the ID of the first object
even though in my second form the hidden field is correctly filled with the
ID of the second object... I assume, this will bug me for a while... <sighs>

Thanks for all your help.

Greetings,
Nadja

---------------------------------------------------------------------
Nadja  Senoucci
Universitaet Hamburg
Zentrum für Molekulare Neurobiologie
Service-Gruppe EDV
Falkenried 94
20251 Hamburg
Germany
Tel.:040 - 428 - 03 - 6619
Fax.:040 - 428 - 03 - 6621


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


Re[10]: Question about the form tag

Posted by Dirk Markert <di...@dr-markert.de>.
Hello Nadja,

  

***************************************************************

NS> Hello Dirk,

>> something like:
>>
>><html:form action="change" >
>> <html:text property="name" />
>> <html:submit property="f1a" >Senden A</html:submit>
>> <html:submit property="f1b" >Senden B</html:submit>
>> <html:submit property="f1c" >Senden C</html:submit>
>></html:form>
>>
>><html:form action="change" >
>> <html:text property="name" />
>> <html:submit property="f2a" >Senden A</html:submit>
>> <html:submit property="f2b" >Senden B</html:submit>
>> <html:submit property="f2c" >Senden C</html:submit>
>></html:form> 

NS> But then I would still have to be looking for "f2a" in the request, won't
NS> I? And that I could do that would mean that I'd know already which form
NS> should've been submitted and/or which forms or how many existed on page at
NS> all.

NS> This is what my forms look like at the moment (just with more and different
NS> data for each object...):

NS> <html:form action="change" >
NS>  <html:text property="name" />
NS>  <html:submit property="fa" >Senden A</html:submit>
NS>  <html:submit property="fb" >Senden B</html:submit>
NS>  <html:submit property="fc" >Senden C</html:submit>
NS> </html:form>

NS> <html:form action="change" >
NS>  <html:text property="name" />
NS>  <html:submit property="fa" >Senden A</html:submit>
NS>  <html:submit property="fb" >Senden B</html:submit>
NS>  <html:submit property="fc" >Senden C</html:submit>
NS> </html:form>

I set up a test jsp like above and I get values from form 2, if I
click any button of form 2 (and vice versa). I guess either your
struts-config or your action form is not correct.


NS> That allows me to look for "fa" in the request to find out whether it has
NS> been set/pressed or not.

NS> Greetings,
NS> Nadja

NS> ---------------------------------------------------------------------
NS> Nadja  Senoucci
NS> Universitaet Hamburg
NS> Zentrum für Molekulare Neurobiologie
NS> Service-Gruppe EDV
NS> Falkenried 94
NS> 20251 Hamburg
NS> Germany
NS> Tel.:040 - 428 - 03 - 6619
NS> Fax.:040 - 428 - 03 - 6621


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



Regards,
Dirk

+------- Quality leads ---------------------------------------+
| Dirk Markert                     dirk.markert@dr-markert.de |
| Dr. Markert Softwaretechnik AG                              |
| Joseph-von-Fraunhofer-Str. 20                               |
| 44227 Dortmund                                              |
+---------------------------------->>>>>>> to success! <<<<<<-+ 


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


Re: Re[8]: Question about the form tag

Posted by Nadja Senoucci <Na...@zmnh.uni-hamburg.de>.
Hello Dirk,

> something like:
>
><html:form action="change" >
> <html:text property="name" />
> <html:submit property="f1a" >Senden A</html:submit>
> <html:submit property="f1b" >Senden B</html:submit>
> <html:submit property="f1c" >Senden C</html:submit>
></html:form>
>
><html:form action="change" >
> <html:text property="name" />
> <html:submit property="f2a" >Senden A</html:submit>
> <html:submit property="f2b" >Senden B</html:submit>
> <html:submit property="f2c" >Senden C</html:submit>
></html:form> 

But then I would still have to be looking for "f2a" in the request, won't
I? And that I could do that would mean that I'd know already which form
should've been submitted and/or which forms or how many existed on page at
all.

This is what my forms look like at the moment (just with more and different
data for each object...):

<html:form action="change" >
 <html:text property="name" />
 <html:submit property="fa" >Senden A</html:submit>
 <html:submit property="fb" >Senden B</html:submit>
 <html:submit property="fc" >Senden C</html:submit>
</html:form>

<html:form action="change" >
 <html:text property="name" />
 <html:submit property="fa" >Senden A</html:submit>
 <html:submit property="fb" >Senden B</html:submit>
 <html:submit property="fc" >Senden C</html:submit>
</html:form>

That allows me to look for "fa" in the request to find out whether it has
been set/pressed or not.

Greetings,
Nadja

---------------------------------------------------------------------
Nadja  Senoucci
Universitaet Hamburg
Zentrum für Molekulare Neurobiologie
Service-Gruppe EDV
Falkenried 94
20251 Hamburg
Germany
Tel.:040 - 428 - 03 - 6619
Fax.:040 - 428 - 03 - 6621


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


Re[8]: Question about the form tag

Posted by Dirk Markert <di...@dr-markert.de>.
Hello Nadja,

 something like:

<html:form action="change" >
 <html:text property="name" />
 <html:submit property="f1a" >Senden A</html:submit>
 <html:submit property="f1b" >Senden B</html:submit>
 <html:submit property="f1c" >Senden C</html:submit>
</html:form>

<html:form action="change" >
 <html:text property="name" />
 <html:submit property="f2a" >Senden A</html:submit>
 <html:submit property="f2b" >Senden B</html:submit>
 <html:submit property="f2c" >Senden C</html:submit>
</html:form> 

***************************************************************

NS> Hello,

>>    my test looks like:
>>
>><html:form action="change" >
>> <html:text property="name" />
>> <html:submit property="f1" >Senden 1</html:submit>
>></html:form>
>>
>><html:form action="change" >
>> <html:text property="name" />
>> <html:submit property="f2" >Senden 1</html:submit>
>></html:form>
>>
>>Hitting button 1 gives me the text from the first and hitting button 2
>>gives me the text from the second form. Whats the difference to your
>>jsp?

NS> My difference is with the buttons. They also have the same name. I have 4
NS> different submit buttons (actually 5 but only three get displayed at one
NS> time) for every object and two more for the whole form. They have each
NS> different names but the names do not change for different objects. And
NS> since my action looks like this:

NS> if(request.getParameter("aendern")!=null){
NS>         //do change stuff
NS> }else if(request.getParameter("deinventarisieren")!=null){
NS>         //deactivate object
NS> }else if(request.getParameter("reinventarisieren")!=null){
NS>         //reactivate object
NS> }else if(request.getParameter("print_geraet")!=null ||
NS> request.getParameter("print_archiv")!=null){
NS>         //print an object (two different print views)
NS> }else if(request.getParameter("print_multiple_geraete")!=null ||
NS> request.getParameter("print_multiple_archive")!=null){
NS>         //print multiple objects (two different print views)
NS> }

NS> I cannot really change the button names for each object, else I'd never
NS> what to look for in the request...

NS> Or am I doing things too complicated here?

NS> Greetings,
NS> Nadja

NS> ---------------------------------------------------------------------
NS> Nadja  Senoucci
NS> Universitaet Hamburg
NS> Zentrum für Molekulare Neurobiologie
NS> Service-Gruppe EDV
NS> Falkenried 94
NS> 20251 Hamburg
NS> Germany
NS> Tel.:040 - 428 - 03 - 6619
NS> Fax.:040 - 428 - 03 - 6621


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



Regards,
Dirk

+------- Quality leads ---------------------------------------+
| Dirk Markert                     dirk.markert@dr-markert.de |
| Dr. Markert Softwaretechnik AG                              |
| Joseph-von-Fraunhofer-Str. 20                               |
| 44227 Dortmund                                              |
+---------------------------------->>>>>>> to success! <<<<<<-+ 


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


RE: is Struts action class a Design Pattern of utility class?

Posted by Andrew Hill <an...@gridnode.com>.
You shouldnt be using (modifiable) instance methods in an Action class as
actions need to be threadsafe - remember that could be any number of threads
executing that code at the same time! (This is where request attributes come
in handy) so certainly you should be eliminating instance variables and
either declaring them as local and passing between your methods or shoving
them in a bean you pass between your methods or putting them in request
attributes...

As for making your methods static... you probably dont want to do that - you
will be choking off your ability to subclass your action amoung other
things. Take a look in the archive at the discussion last week about
singletons vs statics.

Actions are a helper class not a utility class. They are invoked by the
RequestProcessor to assist it in processing the use case specific logic of
the action.

-----Original Message-----
From: Denis Wang [mailto:dwang@brandmuscle.com]
Sent: Wednesday, 16 July 2003 22:29
To: Struts Users Mailing List
Subject: is Struts action class a Design Pattern of utility class?


Hello, all,
I am not sure whether it is a good practice to:
eliminate instance variables from Struts action class; and
make all methods static.
Basically it turns the action class into a utility class.
Any comments?  Thanks.
Denis


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


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


Re: is Struts action class a Design Pattern of utility class?

Posted by Sandeep Takhar <sa...@yahoo.com>.
You can still have static methods on the action, just
no instance variables that you update.  No instance
variables on actions is generally the case.

sandeep
--- David Graham <gr...@yahoo.com> wrote:
> --- Denis Wang <dw...@brandmuscle.com> wrote:
> > Hello, all,
> > I am not sure whether it is a good practice to:
> > eliminate instance variables from Struts action
> class; and
> > make all methods static.
> > Basically it turns the action class into a utility
> class.
> > Any comments?  Thanks.
> 
> Do *not* make your methods static.  Actions are
> Singletons and many
> threads may be running through them at one time so
> they must be thread
> safe.  This typically means you can't use instance
> variables to maintain
> state.  If you're interested in creating a new
> instance of each Action per
> request (thereby allowing you to use instance
> variables) you should look
> at overriding the
> RequestProcessor.processActionCreate() method.
> 
> David
> 
> 
> 
> > Denis
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


Re: is Struts action class a Design Pattern of utility class?

Posted by David Graham <gr...@yahoo.com>.
--- Denis Wang <dw...@brandmuscle.com> wrote:
> Hello, all,
> I am not sure whether it is a good practice to:
> eliminate instance variables from Struts action class; and
> make all methods static.
> Basically it turns the action class into a utility class.
> Any comments?  Thanks.

Do *not* make your methods static.  Actions are Singletons and many
threads may be running through them at one time so they must be thread
safe.  This typically means you can't use instance variables to maintain
state.  If you're interested in creating a new instance of each Action per
request (thereby allowing you to use instance variables) you should look
at overriding the RequestProcessor.processActionCreate() method.

David



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


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


is Struts action class a Design Pattern of utility class?

Posted by Denis Wang <dw...@brandmuscle.com>.
Hello, all,
I am not sure whether it is a good practice to:
eliminate instance variables from Struts action class; and
make all methods static.
Basically it turns the action class into a utility class.
Any comments?  Thanks.
Denis


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


Re: Re[6]: Question about the form tag

Posted by Nadja Senoucci <Na...@zmnh.uni-hamburg.de>.
Hello,

>    my test looks like:
>
><html:form action="change" >
> <html:text property="name" />
> <html:submit property="f1" >Senden 1</html:submit>
></html:form>
>
><html:form action="change" >
> <html:text property="name" />
> <html:submit property="f2" >Senden 1</html:submit>
></html:form>
>
>Hitting button 1 gives me the text from the first and hitting button 2
>gives me the text from the second form. Whats the difference to your
>jsp?

My difference is with the buttons. They also have the same name. I have 4
different submit buttons (actually 5 but only three get displayed at one
time) for every object and two more for the whole form. They have each
different names but the names do not change for different objects. And
since my action looks like this:

if(request.getParameter("aendern")!=null){
	//do change stuff
}else if(request.getParameter("deinventarisieren")!=null){
	//deactivate object
}else if(request.getParameter("reinventarisieren")!=null){
	//reactivate object
}else if(request.getParameter("print_geraet")!=null ||
request.getParameter("print_archiv")!=null){
	//print an object (two different print views)
}else if(request.getParameter("print_multiple_geraete")!=null ||
request.getParameter("print_multiple_archive")!=null){
	//print multiple objects (two different print views)
}

I cannot really change the button names for each object, else I'd never
what to look for in the request...

Or am I doing things too complicated here?

Greetings,
Nadja

---------------------------------------------------------------------
Nadja  Senoucci
Universitaet Hamburg
Zentrum für Molekulare Neurobiologie
Service-Gruppe EDV
Falkenried 94
20251 Hamburg
Germany
Tel.:040 - 428 - 03 - 6619
Fax.:040 - 428 - 03 - 6621


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


Re[6]: Question about the form tag

Posted by Dirk Markert <di...@dr-markert.de>.
Hello Nadja,

    my test looks like:

<html:form action="change" >
 <html:text property="name" />
 <html:submit property="f1" >Senden 1</html:submit>
</html:form>

<html:form action="change" >
 <html:text property="name" />
 <html:submit property="f2" >Senden 1</html:submit>
</html:form>

Hitting button 1 gives me the text from the first and hitting button 2
gives me the text from the second form. Whats the difference to your
jsp?

***************************************************************

NS> Hello,

>>     I just made a small test with multiple forms on one page. I only
>>     get the params of the form to which the submit action belongs!?

NS> Yes, but I have the same submit action for every form, meaning they all
NS> have this form tag:

NS> <html:form action="/geraetaendern">

NS> That's why I am having problems.

NS> Greetings,
NS> Nadja

NS> ---------------------------------------------------------------------
NS> Nadja  Senoucci
NS> Universitaet Hamburg
NS> Zentrum für Molekulare Neurobiologie
NS> Service-Gruppe EDV
NS> Falkenried 94
NS> 20251 Hamburg
NS> Germany
NS> Tel.:040 - 428 - 03 - 6619
NS> Fax.:040 - 428 - 03 - 6621


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



Regards,
Dirk

+------- Quality leads ---------------------------------------+
| Dirk Markert                     dirk.markert@dr-markert.de |
| Dr. Markert Softwaretechnik AG                              |
| Joseph-von-Fraunhofer-Str. 20                               |
| 44227 Dortmund                                              |
+---------------------------------->>>>>>> to success! <<<<<<-+ 


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


Re: Re[4]: Question about the form tag

Posted by Nadja Senoucci <Na...@zmnh.uni-hamburg.de>.
Hello,

>     I just made a small test with multiple forms on one page. I only
>     get the params of the form to which the submit action belongs!?

Yes, but I have the same submit action for every form, meaning they all
have this form tag:

<html:form action="/geraetaendern">

That's why I am having problems.

Greetings,
Nadja

---------------------------------------------------------------------
Nadja  Senoucci
Universitaet Hamburg
Zentrum für Molekulare Neurobiologie
Service-Gruppe EDV
Falkenried 94
20251 Hamburg
Germany
Tel.:040 - 428 - 03 - 6619
Fax.:040 - 428 - 03 - 6621


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


Re[4]: Question about the form tag

Posted by Dirk Markert <di...@dr-markert.de>.
Hello Nadja,

     I just made a small test with multiple forms on one page. I only
     get the params of the form to which the submit action belongs!?

***************************************************************

NS> Hello again,

>>Lets try to understand what Struts is doing behind the scenes. Your
>>request gets submitted and it will contain a lot of parameters.
>>Actually it will contain parameters with the same name. For form1 it
>>is name, for form2 it is again name. And so on. Now Struts tries to
>>put this into your action form. It grabs one parameter (the first one)
>>and populates your form. If this is correct (depends on your jsp) a
>>solution would be to use indexed props.

NS> Thanks for the answer.

NS> Hmm, indexed props... Haven't made good experiences with them, yet. Which
NS> means: Couldn't get it to work right, yet. ;) Can I make a submit button
NS> indexed as well? Otherwise, I would still have a problem with getting the
NS> right data as I would not know which form's buttons has been pressed.

NS> Greetings,
NS> Nadja

NS> ---------------------------------------------------------------------
NS> Nadja  Senoucci
NS> Universitaet Hamburg
NS> Zentrum für Molekulare Neurobiologie
NS> Service-Gruppe EDV
NS> Falkenried 94
NS> 20251 Hamburg
NS> Germany
NS> Tel.:040 - 428 - 03 - 6619
NS> Fax.:040 - 428 - 03 - 6621


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



Regards,
Dirk

+------- Quality leads ---------------------------------------+
| Dirk Markert                     dirk.markert@dr-markert.de |
| Dr. Markert Softwaretechnik AG                              |
| Joseph-von-Fraunhofer-Str. 20                               |
| 44227 Dortmund                                              |
+---------------------------------->>>>>>> to success! <<<<<<-+ 


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


Re: Re[2]: Question about the form tag

Posted by Nadja Senoucci <Na...@zmnh.uni-hamburg.de>.
Hello again,

>Lets try to understand what Struts is doing behind the scenes. Your
>request gets submitted and it will contain a lot of parameters.
>Actually it will contain parameters with the same name. For form1 it
>is name, for form2 it is again name. And so on. Now Struts tries to
>put this into your action form. It grabs one parameter (the first one)
>and populates your form. If this is correct (depends on your jsp) a
>solution would be to use indexed props.

Thanks for the answer.

Hmm, indexed props... Haven't made good experiences with them, yet. Which
means: Couldn't get it to work right, yet. ;) Can I make a submit button
indexed as well? Otherwise, I would still have a problem with getting the
right data as I would not know which form's buttons has been pressed.

Greetings,
Nadja

---------------------------------------------------------------------
Nadja  Senoucci
Universitaet Hamburg
Zentrum für Molekulare Neurobiologie
Service-Gruppe EDV
Falkenried 94
20251 Hamburg
Germany
Tel.:040 - 428 - 03 - 6619
Fax.:040 - 428 - 03 - 6621


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


Re[2]: Question about the form tag

Posted by Dirk Markert <di...@dr-markert.de>.
Hello Nadja,


***************************************************************

NS> Hello,

>>sounds like you are using many html:form action=""
>>
>>maybe in an iterate?
>>
>>or maybe I am not understanding the problem?

NS> Okay, let me try to explain my problem a bit better. I can search for a
NS> certain kind of object in my application. Those object get displayed on a
NS> page - first only titles. If you click on the titles a more detailed view
NS> of the object appears, including a few form elements (checkboxes and a
NS> hidden field containing the objects id) and buttons. The buttons have
NS> different functionality - one is there for to allow people to change the
NS> object. The checkboxes mark the pages of the object data form that should
NS> be displayed (if none are being checked all will get displayed when the
NS> object is supposed to be changed). 

NS> Since I can find more than one object, I display a list of them on this
NS> page, I've mentioned. More than one of the objects can be opened in the
NS> more detailed view - therefore there will be more than one form with the
NS> exact same action and the same buttons and the same names for fields...

NS> Now, when I have more than one object in a detailed view - and therefore
NS> have more than one form - and I click a button I have to make sure that the
NS> right form gets submitted or I will get the wrong data... And so far I only
NS> ever got the data of the very first form in the page at that moment.

Lets try to understand what Struts is doing behind the scenes. Your
request gets submitted and it will contain a lot of parameters.
Actually it will contain parameters with the same name. For form1 it
is name, for form2 it is again name. And so on. Now Struts tries to
put this into your action form. It grabs one parameter (the first one)
and populates your form. If this is correct (depends on your jsp) a
solution would be to use indexed props.

NS> Is that more understandable now?

NS> Greetings,
NS> Nadja

NS> ---------------------------------------------------------------------
NS> Nadja  Senoucci
NS> Universitaet Hamburg
NS> Zentrum für Molekulare Neurobiologie
NS> Service-Gruppe EDV
NS> Falkenried 94
NS> 20251 Hamburg
NS> Germany
NS> Tel.:040 - 428 - 03 - 6619
NS> Fax.:040 - 428 - 03 - 6621


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



Regards,
Dirk

+------- Quality leads ---------------------------------------+
| Dirk Markert                     dirk.markert@dr-markert.de |
| Dr. Markert Softwaretechnik AG                              |
| Joseph-von-Fraunhofer-Str. 20                               |
| 44227 Dortmund                                              |
+---------------------------------->>>>>>> to success! <<<<<<-+ 


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


Re: Question about the form tag

Posted by Eugen Bushuev <bu...@lucky.net>.

>Now, when I have more than one object in a detailed view - and therefore
>have more than one form - and I click a button I have to make sure that the
>right form gets submitted or I will get the wrong data... And so far I only
>ever got the data of the very first form in the page at that moment.
>
>Is that more understandable now?
>
I hope :)
So, you have lotsa objects on you page:
Object 1
<form action...>
fafa
<html:submit...>
<html:hiddend property="id" value="<%=object.getId()%>"/>
</form>

Object 2
<form action...>
fafa
<html:submit...>
<html:hiddend property="id" value="<%=object.getId()%>"/>
</form>

And so on. If i make it out correctly. Thus, when you push some of the submit buttons correspondent object data gets submitted.

wbr, eugen.

>
>Greetings,
>Nadja
>
>---------------------------------------------------------------------
>Nadja  Senoucci
>Universitaet Hamburg
>Zentrum für Molekulare Neurobiologie
>Service-Gruppe EDV
>Falkenried 94
>20251 Hamburg
>Germany
>Tel.:040 - 428 - 03 - 6619
>Fax.:040 - 428 - 03 - 6621
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>  
>

-- 
? ?????????, ?.??????.



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


Re: Question about the form tag

Posted by Sandeep Takhar <sa...@yahoo.com>.
yes it is more understandable...

As someone else has indicated, this is solved using
indexed properties usually...

sandeep
--- Nadja Senoucci
<Na...@zmnh.uni-hamburg.de> wrote:
> Hello,
> 
> >sounds like you are using many html:form action=""
> >
> >maybe in an iterate?
> >
> >or maybe I am not understanding the problem?
> 
> Okay, let me try to explain my problem a bit better.
> I can search for a
> certain kind of object in my application. Those
> object get displayed on a
> page - first only titles. If you click on the titles
> a more detailed view
> of the object appears, including a few form elements
> (checkboxes and a
> hidden field containing the objects id) and buttons.
> The buttons have
> different functionality - one is there for to allow
> people to change the
> object. The checkboxes mark the pages of the object
> data form that should
> be displayed (if none are being checked all will get
> displayed when the
> object is supposed to be changed). 
> 
> Since I can find more than one object, I display a
> list of them on this
> page, I've mentioned. More than one of the objects
> can be opened in the
> more detailed view - therefore there will be more
> than one form with the
> exact same action and the same buttons and the same
> names for fields...
> 
> Now, when I have more than one object in a detailed
> view - and therefore
> have more than one form - and I click a button I
> have to make sure that the
> right form gets submitted or I will get the wrong
> data... And so far I only
> ever got the data of the very first form in the page
> at that moment.
> 
> Is that more understandable now?
> 
> Greetings,
> Nadja
> 
>
---------------------------------------------------------------------
> Nadja  Senoucci
> Universitaet Hamburg
> Zentrum f�r Molekulare Neurobiologie
> Service-Gruppe EDV
> Falkenried 94
> 20251 Hamburg
> Germany
> Tel.:040 - 428 - 03 - 6619
> Fax.:040 - 428 - 03 - 6621
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


Re: Question about the form tag

Posted by Nadja Senoucci <Na...@zmnh.uni-hamburg.de>.
Hello,

>sounds like you are using many html:form action=""
>
>maybe in an iterate?
>
>or maybe I am not understanding the problem?

Okay, let me try to explain my problem a bit better. I can search for a
certain kind of object in my application. Those object get displayed on a
page - first only titles. If you click on the titles a more detailed view
of the object appears, including a few form elements (checkboxes and a
hidden field containing the objects id) and buttons. The buttons have
different functionality - one is there for to allow people to change the
object. The checkboxes mark the pages of the object data form that should
be displayed (if none are being checked all will get displayed when the
object is supposed to be changed). 

Since I can find more than one object, I display a list of them on this
page, I've mentioned. More than one of the objects can be opened in the
more detailed view - therefore there will be more than one form with the
exact same action and the same buttons and the same names for fields...

Now, when I have more than one object in a detailed view - and therefore
have more than one form - and I click a button I have to make sure that the
right form gets submitted or I will get the wrong data... And so far I only
ever got the data of the very first form in the page at that moment.

Is that more understandable now?

Greetings,
Nadja

---------------------------------------------------------------------
Nadja  Senoucci
Universitaet Hamburg
Zentrum für Molekulare Neurobiologie
Service-Gruppe EDV
Falkenried 94
20251 Hamburg
Germany
Tel.:040 - 428 - 03 - 6619
Fax.:040 - 428 - 03 - 6621


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


Re: Question about the form tag

Posted by Sandeep Takhar <sa...@yahoo.com>.
sounds like you are using many html:form action=""

maybe in an iterate?

or maybe I am not understanding the problem?

sandeep
--- Nadja Senoucci
<Na...@zmnh.uni-hamburg.de> wrote:
> Hello again,
> 
> >Add a hidden field with the name to every form
> which will identify it.
> 
> Hmm... I have a few problems with that idea.
> 
> 1) I can't give the forms names due to the form tag
> not allowing me to do so.
> 2) If I were to simply write a string into that
> hidden field - that would
> then exist in every form - I'd have the same trouble
> as before, only the
> value of the first form's hidden field would get
> submitted.
> 3) I will have an uncertain number of these forms on
> this page (depending
> on data being read out and such). I would have to be
> able to get a
> Collection of some kind with all possible form names
> to make this at least
> somewhat comfortable and workable...
> 
> Maybe I didn't quite understand what you meant but
> the way I understood it
> it won't help me a lot, I fear.
> 
> Thank you, anyway.
> 
> Greetings,
> Nadja (still has no idea how to do this)
> 
>
---------------------------------------------------------------------
> Nadja  Senoucci
> Universitaet Hamburg
> Zentrum f�r Molekulare Neurobiologie
> Service-Gruppe EDV
> Falkenried 94
> 20251 Hamburg
> Germany
> Tel.:040 - 428 - 03 - 6619
> Fax.:040 - 428 - 03 - 6621
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


Re: Question about the form tag

Posted by Nadja Senoucci <Na...@zmnh.uni-hamburg.de>.
Hello again,

>Add a hidden field with the name to every form which will identify it.

Hmm... I have a few problems with that idea.

1) I can't give the forms names due to the form tag not allowing me to do so.
2) If I were to simply write a string into that hidden field - that would
then exist in every form - I'd have the same trouble as before, only the
value of the first form's hidden field would get submitted.
3) I will have an uncertain number of these forms on this page (depending
on data being read out and such). I would have to be able to get a
Collection of some kind with all possible form names to make this at least
somewhat comfortable and workable...

Maybe I didn't quite understand what you meant but the way I understood it
it won't help me a lot, I fear.

Thank you, anyway.

Greetings,
Nadja (still has no idea how to do this)

---------------------------------------------------------------------
Nadja  Senoucci
Universitaet Hamburg
Zentrum für Molekulare Neurobiologie
Service-Gruppe EDV
Falkenried 94
20251 Hamburg
Germany
Tel.:040 - 428 - 03 - 6619
Fax.:040 - 428 - 03 - 6621


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


Re: Question about the form tag

Posted by Eugen Bushuev <bu...@lucky.net>.
Hi.
Add a hidden field with the name to every form which will identify it.


Nadja Senoucci wrote:

>Hello everyone,
>
>I have two or more forms on one page, but actually they are all the same
>forms, just with different values in them (it's all about one hidden field
>and a few checkboxes, really). Now, these forms all have the same
>action-mapping, since they are basically the same. When I press a button
>now, it doesn't recognize which form it belonged to and just takes the
>first one... Is there a way to find out which form's button has been
>pressed? I thought maybe giving the form a name would help but that doesn't
>seem to be possible with the form tag...
>
>Any ideas?
>
>Greetings,
>Nadja
>
>---------------------------------------------------------------------
>Nadja  Senoucci
>Universitaet Hamburg
>Zentrum für Molekulare Neurobiologie
>Service-Gruppe EDV
>Falkenried 94
>20251 Hamburg
>Germany
>Tel.:040 - 428 - 03 - 6619
>Fax.:040 - 428 - 03 - 6621
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>  
>

-- 
? ?????????, ?.??????.



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