You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eduardo Dela Rosa <ed...@gmail.com> on 2008/05/08 04:17:10 UTC

Can you set parameters in using in the tag body?

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 using in the tag body?

Posted by Steve Akins <ak...@gmail.com>.
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
<je...@blueskyminds.com.au> 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@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: Can you set parameters in using in the tag body?

Posted by Eduardo Dela Rosa <ed...@gmail.com>.
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@blueskyminds.com.au> 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@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Eduardo Dela Rosa

Re: Can you set parameters in using in the tag body?

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
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@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Can you set parameters in using in the tag body?

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
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@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Can you set parameters in using in the tag body?

Posted by Richard Sayre <ri...@gmail.com>.
Could you use s:hidden on the form to store your params?

On Wed, May 7, 2008 at 10:47 PM, Eduardo Dela Rosa
<ed...@gmail.com> 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@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org