You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by lucas owen <sr...@gmail.com> on 2010/03/05 20:46:06 UTC

possible s:submit with parameter?

Hi Struts users:

I'm wondering if it is possible to pass a parameter inside a s:submit tag.

I'm working with the following form (this is just a sketch) on a webpage, in
which I collect some user data and display a list of elements (let's say
books):

          ___________                         ____________
Name:|___________|         Surname: |____________|


List of Books:

          Title
Author                                            Details
--------------------------------------------------------------------------------------------------------------------------------------------
           XYZ                                ABC
<s:submit action="bookDetails" param="bookId">


...

Note: it has to be a submit because if the user enters a name or surname, I
want it to be displayed when the users comes back from the book details
page!

I dont know if this is possible with Struts 2

Thanks in advance

Re: possible s:submit with parameter?

Posted by lucas owen <sr...@gmail.com>.
Of course!!

The problem is I can't use javascript, the application is supposed to work
in any computer, any browser...no matter how old they are

Any suggestions?

2010/3/5 Burton Rhodes <bu...@gmail.com>

> Sounds like a good use for javascript , not a struts tag.
>
> On 3/5/10, lucas owen <sr...@gmail.com> wrote:
> > Hi Struts users:
> >
> > I'm wondering if it is possible to pass a parameter inside a s:submit
> tag.
> >
> > I'm working with the following form (this is just a sketch) on a webpage,
> in
> > which I collect some user data and display a list of elements (let's say
> > books):
> >
> >           ___________                         ____________
> > Name:|___________|         Surname: |____________|
> >
> >
> > List of Books:
> >
> >           Title
> > Author                                            Details
> >
> --------------------------------------------------------------------------------------------------------------------------------------------
> >            XYZ                                ABC
> > <s:submit action="bookDetails" param="bookId">
> >
> >
> > ...
> >
> > Note: it has to be a submit because if the user enters a name or surname,
> I
> > want it to be displayed when the users comes back from the book details
> > page!
> >
> > I dont know if this is possible with Struts 2
> >
> > Thanks in advance
> >
>
> --
> Sent from my mobile device
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: possible s:submit with parameter?

Posted by Burton Rhodes <bu...@gmail.com>.
Sounds like a good use for javascript , not a struts tag.

On 3/5/10, lucas owen <sr...@gmail.com> wrote:
> Hi Struts users:
>
> I'm wondering if it is possible to pass a parameter inside a s:submit tag.
>
> I'm working with the following form (this is just a sketch) on a webpage, in
> which I collect some user data and display a list of elements (let's say
> books):
>
>           ___________                         ____________
> Name:|___________|         Surname: |____________|
>
>
> List of Books:
>
>           Title
> Author                                            Details
> --------------------------------------------------------------------------------------------------------------------------------------------
>            XYZ                                ABC
> <s:submit action="bookDetails" param="bookId">
>
>
> ...
>
> Note: it has to be a submit because if the user enters a name or surname, I
> want it to be displayed when the users comes back from the book details
> page!
>
> I dont know if this is possible with Struts 2
>
> Thanks in advance
>

-- 
Sent from my mobile device

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


Re: possible s:submit with parameter?

Posted by lucas owen <sr...@gmail.com>.
thanks to all

you have been very very helpful!!!

2010/3/8 Alex Rodriguez Lopez <al...@flordeutopia.pt>

> You can use hidden fields inside of the form which will be sent too on
> submit as GET or POST params(usually good for IDs).
>
> Alex
>
> Em 05-03-2010 23:13, Adam Pinder escreveu:
>
> Any form textfield will be submitted when page submitted which is
>> effectively a parameter.
>>
>> Adam
>>
>> On 5 Mar 2010, at 19:46, lucas owen <sr...@gmail.com> wrote:
>>
>> Hi Struts users:
>>>
>>> I'm wondering if it is possible to pass a parameter inside a s:submit
>>> tag.
>>>
>>> I'm working with the following form (this is just a sketch) on a
>>> webpage, in
>>> which I collect some user data and display a list of elements (let's say
>>> books):
>>>
>>> ___________ ____________
>>> Name:|___________| Surname: |____________|
>>>
>>>
>>> List of Books:
>>>
>>> Title
>>> Author Details
>>>
>>> --------------------------------------------------------------------------------------------------------------------------------------------
>>>
>>> XYZ ABC
>>> <s:submit action="bookDetails" param="bookId">
>>>
>>>
>>> ...
>>>
>>> Note: it has to be a submit because if the user enters a name or
>>> surname, I
>>> want it to be displayed when the users comes back from the book details
>>> page!
>>>
>>> I dont know if this is possible with Struts 2
>>>
>>> Thanks in advance
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: possible s:submit with parameter?

Posted by Alex Rodriguez Lopez <al...@flordeutopia.pt>.
You can use hidden fields inside of the form which will be sent too on 
submit as GET or POST params(usually good for IDs).

Alex

Em 05-03-2010 23:13, Adam Pinder escreveu:
> Any form textfield will be submitted when page submitted which is
> effectively a parameter.
>
> Adam
>
> On 5 Mar 2010, at 19:46, lucas owen <sr...@gmail.com> wrote:
>
>> Hi Struts users:
>>
>> I'm wondering if it is possible to pass a parameter inside a s:submit
>> tag.
>>
>> I'm working with the following form (this is just a sketch) on a
>> webpage, in
>> which I collect some user data and display a list of elements (let's say
>> books):
>>
>> ___________ ____________
>> Name:|___________| Surname: |____________|
>>
>>
>> List of Books:
>>
>> Title
>> Author Details
>> --------------------------------------------------------------------------------------------------------------------------------------------
>>
>> XYZ ABC
>> <s:submit action="bookDetails" param="bookId">
>>
>>
>> ...
>>
>> Note: it has to be a submit because if the user enters a name or
>> surname, I
>> want it to be displayed when the users comes back from the book details
>> page!
>>
>> I dont know if this is possible with Struts 2
>>
>> Thanks in advance
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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


RE: possible s:submit with parameter?

Posted by adam pinder <ap...@hotmail.co.uk>.
 

in the form, make your booklist a select box (with id as the option value) or display as text with a radio button group (i.e. each book has the same radio button id) when you press submit, the id of the book selected will be sent to the action and you can use that to retrieve the book detail .....


 
> Date: Sun, 7 Mar 2010 10:26:39 -0600
> Subject: Re: possible s:submit with parameter?
> From: burtonrhodes@gmail.com
> To: user@struts.apache.org
> 
> Adam is correct. Every item filled out in the form is sent to your
> action. You can save these variables in the session or alternaitvely
> store them in each subsequent jsp with hidden form variables. You can
> use struts to display these properties/variables whereever you want. I
> think you are making your requirement more complicated than necessary.
> 
> On 3/6/10, lucas owen <sr...@gmail.com> wrote:
> > yes, of course...
> >
> > but imagine you have a list of elements, how do you pass the Id of the
> > element you want to display in other page with a s:submit???
> > (I cant use javascript)
> > 2010/3/6 Adam Pinder <ap...@hotmail.co.uk>
> >
> >> Any form textfield will be submitted when page submitted which is
> >> effectively a parameter.
> >>
> >> Adam
> >>
> >>
> >> On 5 Mar 2010, at 19:46, lucas owen <sr...@gmail.com> wrote:
> >>
> >> Hi Struts users:
> >>>
> >>> I'm wondering if it is possible to pass a parameter inside a s:submit
> >>> tag.
> >>>
> >>> I'm working with the following form (this is just a sketch) on a webpage,
> >>> in
> >>> which I collect some user data and display a list of elements (let's say
> >>> books):
> >>>
> >>> ___________ ____________
> >>> Name:|___________| Surname: |____________|
> >>>
> >>>
> >>> List of Books:
> >>>
> >>> Title
> >>> Author Details
> >>>
> >>> --------------------------------------------------------------------------------------------------------------------------------------------
> >>> XYZ ABC
> >>> <s:submit action="bookDetails" param="bookId">
> >>>
> >>>
> >>> ...
> >>>
> >>> Note: it has to be a submit because if the user enters a name or surname,
> >>> I
> >>> want it to be displayed when the users comes back from the book details
> >>> page!
> >>>
> >>> I dont know if this is possible with Struts 2
> >>>
> >>> Thanks in advance
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> 
> -- 
> Sent from my mobile device
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  
_________________________________________________________________
Send us your Hotmail stories and be featured in our newsletter
http://clk.atdmt.com/UKM/go/195013117/direct/01/

Re: possible s:submit with parameter?

Posted by Burton Rhodes <bu...@gmail.com>.
Adam is correct. Every item filled out in the form is sent to your
action. You can save these variables in the session or alternaitvely
store them in each subsequent jsp with hidden form variables. You can
use struts to display these properties/variables whereever you want. I
think you are making your requirement more complicated than necessary.

On 3/6/10, lucas owen <sr...@gmail.com> wrote:
> yes, of course...
>
> but imagine you have a list of elements, how do you pass the Id of the
> element you want to display in other page with a s:submit???
> (I cant use javascript)
> 2010/3/6 Adam Pinder <ap...@hotmail.co.uk>
>
>> Any form textfield will be submitted when page submitted which is
>> effectively a parameter.
>>
>> Adam
>>
>>
>> On 5 Mar 2010, at 19:46, lucas owen <sr...@gmail.com> wrote:
>>
>> Hi Struts users:
>>>
>>> I'm wondering if it is possible to pass a parameter inside a s:submit
>>> tag.
>>>
>>> I'm working with the following form (this is just a sketch) on a webpage,
>>> in
>>> which I collect some user data and display a list of elements (let's say
>>> books):
>>>
>>>         ___________                         ____________
>>> Name:|___________|         Surname: |____________|
>>>
>>>
>>> List of Books:
>>>
>>>         Title
>>> Author                                            Details
>>>
>>> --------------------------------------------------------------------------------------------------------------------------------------------
>>>          XYZ                                ABC
>>> <s:submit action="bookDetails" param="bookId">
>>>
>>>
>>> ...
>>>
>>> Note: it has to be a submit because if the user enters a name or surname,
>>> I
>>> want it to be displayed when the users comes back from the book details
>>> page!
>>>
>>> I dont know if this is possible with Struts 2
>>>
>>> Thanks in advance
>>>
>>
>>  ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>

-- 
Sent from my mobile device

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


Re: possible s:submit with parameter?

Posted by lucas owen <sr...@gmail.com>.
yes, of course...

but imagine you have a list of elements, how do you pass the Id of the
element you want to display in other page with a s:submit???
(I cant use javascript)
2010/3/6 Adam Pinder <ap...@hotmail.co.uk>

> Any form textfield will be submitted when page submitted which is
> effectively a parameter.
>
> Adam
>
>
> On 5 Mar 2010, at 19:46, lucas owen <sr...@gmail.com> wrote:
>
> Hi Struts users:
>>
>> I'm wondering if it is possible to pass a parameter inside a s:submit tag.
>>
>> I'm working with the following form (this is just a sketch) on a webpage,
>> in
>> which I collect some user data and display a list of elements (let's say
>> books):
>>
>>         ___________                         ____________
>> Name:|___________|         Surname: |____________|
>>
>>
>> List of Books:
>>
>>         Title
>> Author                                            Details
>>
>> --------------------------------------------------------------------------------------------------------------------------------------------
>>          XYZ                                ABC
>> <s:submit action="bookDetails" param="bookId">
>>
>>
>> ...
>>
>> Note: it has to be a submit because if the user enters a name or surname,
>> I
>> want it to be displayed when the users comes back from the book details
>> page!
>>
>> I dont know if this is possible with Struts 2
>>
>> Thanks in advance
>>
>
>  ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: possible s:submit with parameter?

Posted by Adam Pinder <ap...@hotmail.co.uk>.
Any form textfield will be submitted when page submitted which is  
effectively a parameter.

Adam

On 5 Mar 2010, at 19:46, lucas owen <sr...@gmail.com> wrote:

> Hi Struts users:
>
> I'm wondering if it is possible to pass a parameter inside a  
> s:submit tag.
>
> I'm working with the following form (this is just a sketch) on a  
> webpage, in
> which I collect some user data and display a list of elements (let's  
> say
> books):
>
>          ___________                         ____________
> Name:|___________|         Surname: |____________|
>
>
> List of Books:
>
>          Title
> Author                                            Details
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --- 
> --------------------------------------------------------------------
>           XYZ                                ABC
> <s:submit action="bookDetails" param="bookId">
>
>
> ...
>
> Note: it has to be a submit because if the user enters a name or  
> surname, I
> want it to be displayed when the users comes back from the book  
> details
> page!
>
> I dont know if this is possible with Struts 2
>
> Thanks in advance

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