You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Grish <gi...@hotmail.com> on 2007/10/18 13:09:48 UTC
Access a SiteMesh Object in a Struts tag
Hi,
I was wondering if this is possible, I want to access a SiteMesh object in a
struts tag like the set tag:
I want to access the Page object from SiteMesh and get a property from that
object and assign it a value
<decorator:usePage id="myPage" />
<s:set name="currentPage" value="" />
where value would be myPage.getProperty("meta.curentPage").
I have a feeling i'm just using incorrect syntax. Can anyone point me to the
right direction?
Thanks!
--
View this message in context: http://www.nabble.com/Access-a-SiteMesh-Object-in-a-Struts-tag-tf4646229.html#a13272172
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Access a SiteMesh Object in a Struts tag
Posted by Xyzr <xy...@gmail.com>.
Thanx a lot. This works!
Grish wrote:
>
> <decorator:usePage id="myPage" />
> <s:set name="currentNav"
> value="%{#attr.myPage.getProperty('meta.currentNav')}" />
>
--
View this message in context: http://www.nabble.com/-S2--Access-a-SiteMesh-Object-in-a-Struts-tag-tp13272172p24800510.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Access a SiteMesh Object in a Struts tag
Posted by Grish <gi...@hotmail.com>.
After going through the OGNL documents and trial and error I was able to get
the properties from the page object from sitemesh using the following code:
<decorator:usePage id="myPage" />
<s:set name="currentNav"
value="%{#attr.myPage.getProperty('meta.currentNav')}" />
Hope this is of some use to someone out there :)
Grish wrote:
>
> So I tried the following:
>
> <decorator:usePage id="myPage" />
> <% String current = myPage.getProperty("meta.current"); %>
> <s:set name="currentPage" value="#attr.current" />
> <!-- <s:property value="#currentPage" /> -->
>
> but this displays blank. What I want to do is get the property from the
> Page object of sitemesh and make it accessible to my s2 tags. I was
> reading about OGNL and the syntax but i can't seem to get that property.
> Is my syntax incorrect?
>
>
> Grish wrote:
>>
>> Hi,
>>
>> I was wondering if this is possible, I want to access a SiteMesh object
>> in a struts tag like the set tag:
>>
>> I want to access the Page object from SiteMesh and get a property from
>> that object and assign it a value
>>
>> <decorator:usePage id="myPage" />
>>
>> <s:set name="currentPage" value="" />
>>
>> where value would be myPage.getProperty("meta.curentPage").
>>
>> I have a feeling i'm just using incorrect syntax. Can anyone point me to
>> the right direction?
>>
>> Thanks!
>>
>
>
--
View this message in context: http://www.nabble.com/-S2--Access-a-SiteMesh-Object-in-a-Struts-tag-tf4646229.html#a13336246
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Access a SiteMesh Object in a Struts tag
Posted by Grish <gi...@hotmail.com>.
So I tried the following:
<decorator:usePage id="myPage" />
<% String current = myPage.getProperty("meta.current"); %>
<s:set name="currentPage" value="#attr.current" />
<!-- <s:property value="#currentPage" /> -->
but this displays blank. What I want to do is get the property from the Page
object of sitemesh and make it accessible to my s2 tags. I was reading about
OGNL and the syntax but i can't seem to get that property. Is my syntax
incorrect?
Grish wrote:
>
> Hi,
>
> I was wondering if this is possible, I want to access a SiteMesh object in
> a struts tag like the set tag:
>
> I want to access the Page object from SiteMesh and get a property from
> that object and assign it a value
>
> <decorator:usePage id="myPage" />
>
> <s:set name="currentPage" value="" />
>
> where value would be myPage.getProperty("meta.curentPage").
>
> I have a feeling i'm just using incorrect syntax. Can anyone point me to
> the right direction?
>
> Thanks!
>
--
View this message in context: http://www.nabble.com/-S2--Access-a-SiteMesh-Object-in-a-Struts-tag-tf4646229.html#a13292503
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org