Can you set parameters in <s:submit> using <s:param> in the tag body?

View: New views
6 Messages — Rating Filter:   Alert me  

Can you set parameters in <s:submit> using <s:param> in the tag body?

by edwin dela rosa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I was trying to use the <s:submit> and invoke it with *some *parameters
using <s:param>.

i.e.,

*<s:submit ...>
  <s:param ../>
  <s:param ../>
  <s:param ../>
</submit>*

However, the parameters don't seem to be getting through to the
HttpServletRequest object
when interrogated inside the Action.

I know I can use the <s:url> instead, but I preferred the <s:submit>.

I'm implementing ServletRequestAware interface, by the way.

Thanks.

--
Eduardo Dela Rosa

Re: Can you set parameters in <s:submit> using <s:param> in the tag body?

by Jeromy Evans - Blue Sky Minds :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eduardo Dela Rosa wrote:

> Hi,
>
> I was trying to use the <s:submit> and invoke it with *some *parameters
> using <s:param>.
>
> i.e.,
>
> *<s:submit ...>
>   <s:param ../>
>   <s:param ../>
>   <s:param ../>
> </submit>*
>
> However, the parameters don't seem to be getting through to the
> HttpServletRequest object
> when interrogated inside the Action.
>
> I know I can use the <s:url> instead, but I preferred the <s:submit>.
>
> I'm implementing ServletRequestAware interface, by the way.
>
> Thanks.
>
>  

No, that's not supported.  It would have to append the parameters to the
query string or create post parameters after the specific submit button
is pressed. That would need to be implemented using a javascript
listener attached to the click or submit event.  It's a nice idea though.

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


Re: Can you set parameters in <s:submit> using <s:param> in the tag body?

by akinss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Are these parameters static?  If they are you could set them up in
struts config and get the submit button to direct to a specific action
mapping with these parameters defined.

Cheers,
Steve


On Thu, May 8, 2008 at 9:24 PM, Jeromy Evans
<jeromy.evans@...> wrote:

> Eduardo Dela Rosa wrote:
> > Hi,
> >
> > I was trying to use the <s:submit> and invoke it with *some *parameters
> > using <s:param>.
> >
> > i.e.,
> >
> > *<s:submit ...>
> >  <s:param ../>
> >  <s:param ../>
> >  <s:param ../>
> > </submit>*
> >
> > However, the parameters don't seem to be getting through to the
> > HttpServletRequest object
> > when interrogated inside the Action.
> >
> > I know I can use the <s:url> instead, but I preferred the <s:submit>.
> >
> > I'm implementing ServletRequestAware interface, by the way.
> >
> > Thanks.
> >
> >
> >
>
> No, that's not supported.  It would have to append the parameters to the
> query string or create post parameters after the specific submit button is
> pressed. That would need to be implemented using a javascript listener
> attached to the click or submit event.  It's a nice idea though.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>

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


Re: Can you set parameters in <s:submit> using <s:param> in the tag body?

by Richard Sayre :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Could you use s:hidden on the form to store your params?

On Wed, May 7, 2008 at 10:47 PM, Eduardo Dela Rosa
<eduardo.delarosa@...> wrote:

> Hi,
>
>  I was trying to use the <s:submit> and invoke it with *some *parameters
>  using <s:param>.
>
>  i.e.,
>
>  *<s:submit ...>
>   <s:param ../>
>   <s:param ../>
>   <s:param ../>
>  </submit>*
>
>  However, the parameters don't seem to be getting through to the
>  HttpServletRequest object
>  when interrogated inside the Action.
>
>  I know I can use the <s:url> instead, but I preferred the <s:submit>.
>
>  I'm implementing ServletRequestAware interface, by the way.
>
>  Thanks.
>
>  --
>  Eduardo Dela Rosa
>

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


Re: Can you set parameters in <s:submit> using <s:param> in the tag body?

by Jeromy Evans - Blue Sky Minds :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jeromy Evans wrote:
>
> No, that's not supported.  It would have to append the parameters to
> the query string or create post parameters after the specific submit
> button is pressed. That would need to be implemented using a
> javascript listener attached to the click or submit event.  It's a
> nice idea though.
> ---------------------------------------------------------------------

I should add that the action and method attributes of <submit> work by
appending the action or method value into the name/value of the <input>
for the submit button. The selected submit button's name/value are one
of the submitted form's parameters.  Embedding an arbitrary number of
params into the name/value of the submit would not be as elegant.


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


Re: Can you set parameters in <s:submit> using <s:param> in the tag body?

by edwin dela rosa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for your reply Jeromy.

I've read Mark's Struts 2 Cookbook and it gave me good ideas.

What I just did was the following:

   - Create an action in the struts.xml
   - Used that particular action in the <s:submit> tag
   - In the struts.xml, I've set some dynamic parameters along with the
   action definition

Everything went like charm.

Cheers!
Eduardo

On Thu, May 8, 2008 at 9:57 PM, Jeromy Evans <
jeromy.evans@...> wrote:

> Jeromy Evans wrote:
>
>>
>> No, that's not supported.  It would have to append the parameters to the
>> query string or create post parameters after the specific submit button is
>> pressed. That would need to be implemented using a javascript listener
>> attached to the click or submit event.  It's a nice idea though.
>> ---------------------------------------------------------------------
>>
>
> I should add that the action and method attributes of <submit> work by
> appending the action or method value into the name/value of the <input> for
> the submit button. The selected submit button's name/value are one of the
> submitted form's parameters.  Embedding an arbitrary number of params into
> the name/value of the submit would not be as elegant.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>


--
Eduardo Dela Rosa