You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by poof65 <po...@gmail.com> on 2010/03/25 11:01:02 UTC

[Struts2] Retrieve parameter scope variables with OGNL

Hi,

i'm using jsp:include to include a jsp from another but i've a problem
to get the value set in the jsp:param tag.

<jsp:include page="../include/blocs/blocEnteteDossier.jsp">
	<jsp:param name="blocSource" value="depeche" />
</jsp:include>

I can display the value with EL (${ param.blocSource }) but my goal is
to test it in a s:if tag.
I've tried many solutions but none of them give me the correct result.

<s:property value="blocSource"/>
<s:property value="#blocSource"/>
<s:property value="#attr.blocSource"/>
<s:property value="#request.blocSource"/>
<s:property value="#session.blocSource"/>
<s:property value="#application.blocSource"/>
<s:property value="#parameters.blocSource"/>


My question is, are the struts scopes compatbiles with standards
jsp/servlets scopes ?

Thanks for reading :-)

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


Re: [Struts2] Retrieve parameter scope variables with OGNL

Posted by poof65 <po...@gmail.com>.
Ok thank you for the answer.
I've had already found a workaround using s:set but i wanted to know
if a clean solution did exist.

I will take a look at tag file when i'll have some free time.

On Thu, Mar 25, 2010 at 3:00 PM, Greg Lindholm <gr...@gmail.com> wrote:
> This seems to be a common problem that has been asked about many times
> on this list (see search for include + param):
>
> http://old.nabble.com/forum/Search.jtp?forum=206&local=y&query=include+param
>
> I've never seen a definitive answer (but maybe it's buried in the above search).
>
> In my latest project we decided to switch to using Tag files instead
> of includes and they work great, I'll never go back to includes.  With
> tag files you can pass type-safe parameters (called attributes) and
> they are easy to access in struts tags with #attr.
>
> Here are a couple references on Tag files.
>
> http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPTags5.html
>
> http://onjava.com/pub/a/onjava/excerpt/jserverpages3_ch11/index.html
>
>
>
> On Thu, Mar 25, 2010 at 9:04 AM, poof65 <po...@gmail.com> wrote:
>> No i didn't try this syntax because param is a special EL variable
>> that contain request parameter and i don't have a variable named
>> param.
>>
>> I've just tried to be sure and it didn't work either.
>> I thought it was contained in the ognl #parameters special variable
>> but apparently it's not the case.
>>
>> On Thu, Mar 25, 2010 at 12:20 PM, Hoying, Ken <Ke...@premierinc.com> wrote:
>>> If you can display it with ${ param.blocSource }, did you try #attr.param.blocSource?
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: poof65 [mailto:poof65@gmail.com]
>>> Sent: Thursday, March 25, 2010 6:01 AM
>>> To: user@struts.apache.org
>>> Subject: [Struts2] Retrieve parameter scope variables with OGNL
>>>
>>> Hi,
>>>
>>> i'm using jsp:include to include a jsp from another but i've a problem
>>> to get the value set in the jsp:param tag.
>>>
>>> <jsp:include page="../include/blocs/blocEnteteDossier.jsp">
>>>        <jsp:param name="blocSource" value="depeche" />
>>> </jsp:include>
>>>
>>> I can display the value with EL (${ param.blocSource }) but my goal is
>>> to test it in a s:if tag.
>>> I've tried many solutions but none of them give me the correct result.
>>>
>>> <s:property value="blocSource"/>
>>> <s:property value="#blocSource"/>
>>> <s:property value="#attr.blocSource"/>
>>> <s:property value="#request.blocSource"/>
>>> <s:property value="#session.blocSource"/>
>>> <s:property value="#application.blocSource"/>
>>> <s:property value="#parameters.blocSource"/>
>>>
>>>
>>> My question is, are the struts scopes compatbiles with standards
>>> jsp/servlets scopes ?
>>>
>>> Thanks for reading :-)
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>> -----------------------------------------
>>> ***Note:The information contained in this message may be privileged
>>> and confidential and protected from disclosure. If the reader of
>>> this message is not the intended recipient, or an employee or agent
>>> responsible for delivering this message to the intended recipient,
>>> you are hereby notified that any dissemination, distribution or
>>> copying of this communication is strictly prohibited.  If you have
>>> received this communication in error, please notify the Sender
>>> immediately by replying to the message and deleting it from your
>>> computer.  Thank you.  Premier Inc.
>>
>> ---------------------------------------------------------------------
>> 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
>
>

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


Re: [Struts2] Retrieve parameter scope variables with OGNL

Posted by Greg Lindholm <gr...@gmail.com>.
This seems to be a common problem that has been asked about many times
on this list (see search for include + param):

http://old.nabble.com/forum/Search.jtp?forum=206&local=y&query=include+param

I've never seen a definitive answer (but maybe it's buried in the above search).

In my latest project we decided to switch to using Tag files instead
of includes and they work great, I'll never go back to includes.  With
tag files you can pass type-safe parameters (called attributes) and
they are easy to access in struts tags with #attr.

Here are a couple references on Tag files.

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPTags5.html

http://onjava.com/pub/a/onjava/excerpt/jserverpages3_ch11/index.html



On Thu, Mar 25, 2010 at 9:04 AM, poof65 <po...@gmail.com> wrote:
> No i didn't try this syntax because param is a special EL variable
> that contain request parameter and i don't have a variable named
> param.
>
> I've just tried to be sure and it didn't work either.
> I thought it was contained in the ognl #parameters special variable
> but apparently it's not the case.
>
> On Thu, Mar 25, 2010 at 12:20 PM, Hoying, Ken <Ke...@premierinc.com> wrote:
>> If you can display it with ${ param.blocSource }, did you try #attr.param.blocSource?
>>
>>
>>
>> -----Original Message-----
>> From: poof65 [mailto:poof65@gmail.com]
>> Sent: Thursday, March 25, 2010 6:01 AM
>> To: user@struts.apache.org
>> Subject: [Struts2] Retrieve parameter scope variables with OGNL
>>
>> Hi,
>>
>> i'm using jsp:include to include a jsp from another but i've a problem
>> to get the value set in the jsp:param tag.
>>
>> <jsp:include page="../include/blocs/blocEnteteDossier.jsp">
>>        <jsp:param name="blocSource" value="depeche" />
>> </jsp:include>
>>
>> I can display the value with EL (${ param.blocSource }) but my goal is
>> to test it in a s:if tag.
>> I've tried many solutions but none of them give me the correct result.
>>
>> <s:property value="blocSource"/>
>> <s:property value="#blocSource"/>
>> <s:property value="#attr.blocSource"/>
>> <s:property value="#request.blocSource"/>
>> <s:property value="#session.blocSource"/>
>> <s:property value="#application.blocSource"/>
>> <s:property value="#parameters.blocSource"/>
>>
>>
>> My question is, are the struts scopes compatbiles with standards
>> jsp/servlets scopes ?
>>
>> Thanks for reading :-)
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>> -----------------------------------------
>> ***Note:The information contained in this message may be privileged
>> and confidential and protected from disclosure. If the reader of
>> this message is not the intended recipient, or an employee or agent
>> responsible for delivering this message to the intended recipient,
>> you are hereby notified that any dissemination, distribution or
>> copying of this communication is strictly prohibited.  If you have
>> received this communication in error, please notify the Sender
>> immediately by replying to the message and deleting it from your
>> computer.  Thank you.  Premier Inc.
>
> ---------------------------------------------------------------------
> 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: [Struts2] Retrieve parameter scope variables with OGNL

Posted by poof65 <po...@gmail.com>.
No i didn't try this syntax because param is a special EL variable
that contain request parameter and i don't have a variable named
param.

I've just tried to be sure and it didn't work either.
I thought it was contained in the ognl #parameters special variable
but apparently it's not the case.

On Thu, Mar 25, 2010 at 12:20 PM, Hoying, Ken <Ke...@premierinc.com> wrote:
> If you can display it with ${ param.blocSource }, did you try #attr.param.blocSource?
>
>
>
> -----Original Message-----
> From: poof65 [mailto:poof65@gmail.com]
> Sent: Thursday, March 25, 2010 6:01 AM
> To: user@struts.apache.org
> Subject: [Struts2] Retrieve parameter scope variables with OGNL
>
> Hi,
>
> i'm using jsp:include to include a jsp from another but i've a problem
> to get the value set in the jsp:param tag.
>
> <jsp:include page="../include/blocs/blocEnteteDossier.jsp">
>        <jsp:param name="blocSource" value="depeche" />
> </jsp:include>
>
> I can display the value with EL (${ param.blocSource }) but my goal is
> to test it in a s:if tag.
> I've tried many solutions but none of them give me the correct result.
>
> <s:property value="blocSource"/>
> <s:property value="#blocSource"/>
> <s:property value="#attr.blocSource"/>
> <s:property value="#request.blocSource"/>
> <s:property value="#session.blocSource"/>
> <s:property value="#application.blocSource"/>
> <s:property value="#parameters.blocSource"/>
>
>
> My question is, are the struts scopes compatbiles with standards
> jsp/servlets scopes ?
>
> Thanks for reading :-)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> -----------------------------------------
> ***Note:The information contained in this message may be privileged
> and confidential and protected from disclosure. If the reader of
> this message is not the intended recipient, or an employee or agent
> responsible for delivering this message to the intended recipient,
> you are hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited.  If you have
> received this communication in error, please notify the Sender
> immediately by replying to the message and deleting it from your
> computer.  Thank you.  Premier Inc.

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


RE: [Struts2] Retrieve parameter scope variables with OGNL

Posted by "Hoying, Ken" <Ke...@PremierInc.com>.
If you can display it with ${ param.blocSource }, did you try #attr.param.blocSource?



-----Original Message-----
From: poof65 [mailto:poof65@gmail.com] 
Sent: Thursday, March 25, 2010 6:01 AM
To: user@struts.apache.org
Subject: [Struts2] Retrieve parameter scope variables with OGNL

Hi,

i'm using jsp:include to include a jsp from another but i've a problem
to get the value set in the jsp:param tag.

<jsp:include page="../include/blocs/blocEnteteDossier.jsp">
	<jsp:param name="blocSource" value="depeche" />
</jsp:include>

I can display the value with EL (${ param.blocSource }) but my goal is
to test it in a s:if tag.
I've tried many solutions but none of them give me the correct result.

<s:property value="blocSource"/>
<s:property value="#blocSource"/>
<s:property value="#attr.blocSource"/>
<s:property value="#request.blocSource"/>
<s:property value="#session.blocSource"/>
<s:property value="#application.blocSource"/>
<s:property value="#parameters.blocSource"/>


My question is, are the struts scopes compatbiles with standards
jsp/servlets scopes ?

Thanks for reading :-)

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


-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer.  Thank you.  Premier Inc.