You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jim Collings <jl...@gmail.com> on 2009/05/13 21:16:09 UTC
How do I get a request parameter
It isn't in the value stack but I need to snag it. Can't find any examples
of how to do this.
Clue anyone?
Jim C.
Re: How do I get a request parameter
Posted by Wes Wannemacher <we...@wantii.com>.
On Wed, May 13, 2009 at 3:16 PM, Jim Collings <jl...@gmail.com> wrote:
> It isn't in the value stack but I need to snag it. Can't find any examples
> of how to do this.
>
> Clue anyone?
<s:property value="#parameters.whatever" />
-W
--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How do I get a request parameter
Posted by Jim Collings <jl...@gmail.com>.
>> %{#parameters.someName}
>> %{#parameters['someName']}
>> %{parameters.someName}
>> %{parameters['someName'}
>> parameters.someName
>> parameters['someName']
>> #parameters.someName
>> #parameters['someName']
I believe it turned out to be this one above.
Many thanks to all who assisted. :-)
Jim C.
Re: How do I get a request parameter
Posted by Musachy Barroso <mu...@gmail.com>.
don't forget that what is returned from #parameters['somename'] is an
array of values, so try: #parameters['somename'][0]
musachy
On Wed, May 13, 2009 at 3:57 PM, Wes Wannemacher <we...@wantii.com> wrote:
> Well, parameters are available in the OGNL context through the named
> variable 'parameters.' So, you should be able to do one of -
>
> %{#parameters.someName}
> %{#parameters['someName']}
> %{parameters.someName}
> %{parameters['someName'}
> parameters.someName
> parameters['someName']
> #parameters.someName
> #parameters['someName']
>
> Another possibility is to use plain ol' EL... I think that something
> like ${someName} would work. Of course, if nothing else, I'm guessing
> that <%= request.getParameter("someName") %> is not broken...
>
> -Wes
>
> On Wed, May 13, 2009 at 3:46 PM, Jim Collings <jl...@gmail.com> wrote:
>> The question is simpler than it seems. It's the syntax that's the kicker.
>>
>> The old script based way is like this:
>> <%= request.getParameter("someName") %>
>>
>> What's the new way?
>>
>> On Wed, May 13, 2009 at 3:28 PM, Jim Collings <jl...@gmail.com> wrote:
>>
>>> Has to be in the jsp.
>>> tried:
>>> value="#parameters.something"
>>>
>>> Didnt work. Showed up as text in the textfield we are using.
>>>
>>> On 5/13/09, Terry Gardner <Te...@sun.com> wrote:
>>> > One way is via the ServletActionContext, for example,
>>> > ServletActionContext.getRequest().getParameter(String);
>>> >
>>> > On May 13, 2009, at 3:16 PM, Jim Collings wrote:
>>> >
>>> >> It isn't in the value stack but I need to snag it. Can't find any
>>> >> examples
>>> >> of how to do this.
>>> >>
>>> >> Clue anyone?
>>> >>
>>> >>
>>> >> Jim C.
>>> >
>>> >
>>>
>>
>
>
>
> --
> Wes Wannemacher
> Author - Struts 2 In Practice
> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> http://www.manning.com/wannemacher
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How do I get a request parameter
Posted by Wes Wannemacher <we...@wantii.com>.
Well, parameters are available in the OGNL context through the named
variable 'parameters.' So, you should be able to do one of -
%{#parameters.someName}
%{#parameters['someName']}
%{parameters.someName}
%{parameters['someName'}
parameters.someName
parameters['someName']
#parameters.someName
#parameters['someName']
Another possibility is to use plain ol' EL... I think that something
like ${someName} would work. Of course, if nothing else, I'm guessing
that <%= request.getParameter("someName") %> is not broken...
-Wes
On Wed, May 13, 2009 at 3:46 PM, Jim Collings <jl...@gmail.com> wrote:
> The question is simpler than it seems. It's the syntax that's the kicker.
>
> The old script based way is like this:
> <%= request.getParameter("someName") %>
>
> What's the new way?
>
> On Wed, May 13, 2009 at 3:28 PM, Jim Collings <jl...@gmail.com> wrote:
>
>> Has to be in the jsp.
>> tried:
>> value="#parameters.something"
>>
>> Didnt work. Showed up as text in the textfield we are using.
>>
>> On 5/13/09, Terry Gardner <Te...@sun.com> wrote:
>> > One way is via the ServletActionContext, for example,
>> > ServletActionContext.getRequest().getParameter(String);
>> >
>> > On May 13, 2009, at 3:16 PM, Jim Collings wrote:
>> >
>> >> It isn't in the value stack but I need to snag it. Can't find any
>> >> examples
>> >> of how to do this.
>> >>
>> >> Clue anyone?
>> >>
>> >>
>> >> Jim C.
>> >
>> >
>>
>
--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How do I get a request parameter
Posted by Jim Collings <jl...@gmail.com>.
The question is simpler than it seems. It's the syntax that's the kicker.
The old script based way is like this:
<%= request.getParameter("someName") %>
What's the new way?
On Wed, May 13, 2009 at 3:28 PM, Jim Collings <jl...@gmail.com> wrote:
> Has to be in the jsp.
> tried:
> value="#parameters.something"
>
> Didnt work. Showed up as text in the textfield we are using.
>
> On 5/13/09, Terry Gardner <Te...@sun.com> wrote:
> > One way is via the ServletActionContext, for example,
> > ServletActionContext.getRequest().getParameter(String);
> >
> > On May 13, 2009, at 3:16 PM, Jim Collings wrote:
> >
> >> It isn't in the value stack but I need to snag it. Can't find any
> >> examples
> >> of how to do this.
> >>
> >> Clue anyone?
> >>
> >>
> >> Jim C.
> >
> >
>
Re: How do I get a request parameter
Posted by Wes Wannemacher <we...@wantii.com>.
<s:textfield value="%{#parameters['yourParamName']}" ...
?
We'll probably need more details if this doesn't work. The #parameters
object will hold request parameters. If you aren't able to pull your
request param out of there, then something is broken.
-Wes
On Wed, May 13, 2009 at 3:28 PM, Jim Collings <jl...@gmail.com> wrote:
> Has to be in the jsp.
> tried:
> value="#parameters.something"
>
> Didnt work. Showed up as text in the textfield we are using.
>
> On 5/13/09, Terry Gardner <Te...@sun.com> wrote:
>> One way is via the ServletActionContext, for example,
>> ServletActionContext.getRequest().getParameter(String);
>>
>> On May 13, 2009, at 3:16 PM, Jim Collings wrote:
>>
>>> It isn't in the value stack but I need to snag it. Can't find any
>>> examples
>>> of how to do this.
>>>
>>> Clue anyone?
>>>
>>>
>>> Jim C.
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How do I get a request parameter
Posted by mitch gorman <mg...@shadowtv.com>.
Jim Collings wrote:
> Has to be in the jsp.
> tried:
> value="#parameters.something"
>
>
wrap with %{ }
> Didnt work. Showed up as text in the textfield we are using.
>
> On 5/13/09, Terry Gardner <Te...@sun.com> wrote:
>
>> One way is via the ServletActionContext, for example,
>> ServletActionContext.getRequest().getParameter(String);
>>
>> On May 13, 2009, at 3:16 PM, Jim Collings wrote:
>>
>>
>>> It isn't in the value stack but I need to snag it. Can't find any
>>> examples
>>> of how to do this.
>>>
>>> Clue anyone?
>>>
>>>
>>> Jim C.
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Mitch Gorman
mgorman@shadowtv.com
(215) 764-6310
Skype: mitch.shadowtv.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How do I get a request parameter
Posted by Jim Collings <jl...@gmail.com>.
Has to be in the jsp.
tried:
value="#parameters.something"
Didnt work. Showed up as text in the textfield we are using.
On 5/13/09, Terry Gardner <Te...@sun.com> wrote:
> One way is via the ServletActionContext, for example,
> ServletActionContext.getRequest().getParameter(String);
>
> On May 13, 2009, at 3:16 PM, Jim Collings wrote:
>
>> It isn't in the value stack but I need to snag it. Can't find any
>> examples
>> of how to do this.
>>
>> Clue anyone?
>>
>>
>> Jim C.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How do I get a request parameter
Posted by Terry Gardner <Te...@Sun.COM>.
One way is via the ServletActionContext, for example,
ServletActionContext.getRequest().getParameter(String);
On May 13, 2009, at 3:16 PM, Jim Collings wrote:
> It isn't in the value stack but I need to snag it. Can't find any
> examples
> of how to do this.
>
> Clue anyone?
>
>
> Jim C.