using getParameter in sitemesh3

459 views
Skip to first unread message

Mark Tombs

unread,
Mar 15, 2013, 5:35:42 AM3/15/13
to sitemes...@googlegroups.com
Hi,

I have a site that works ok with sitemesh2, but I want some of the new functionality in sitemesh3 so I am trying it out.  I am doing the following:

On each decorated page I have a <meta name='menu' content='something'/> tag in the header. In the decorator I have navigation, and I am fetching the menu from the meta tag and highlighting the current menu and showing the appropriate submenu etc. I'm doing this with:

<c:set var="menu">
 <decorator:getProperty ="meta.menu" default="overview" />
</c:set>

and then using jsp tags to show and hide the relevant parts of the menu. Not very attractive but it works.

The question is, how do I do this in sitemesh3?  I've tried just replacing the decorator:getProperty tag with sitemesh:write property="meta.menu" /> but it doesn't work, I know I must be missing something...

thanks

Mark

Joe Neuhaus

unread,
Mar 16, 2013, 2:39:43 PM3/16/13
to sitemes...@googlegroups.com
Here is what works for me, which I believe will let you accomplish your goal.

In the decorator, which also has JSTL included:

pageContext.setAttribute("currentPage", "<sitemesh:write property='meta.currentPage'/>");

Which let's me access the value using ${currentPage} with the JSP.  Now, within the page that's being decorated you set it up like so:

<meta name="currentPage" content="<%=currPage%>"/><%-- Pass currentPage as a property to sitemesh (property name is currentPage) --%>

Mark Tombs

unread,
Mar 19, 2013, 3:27:24 AM3/19/13
to sitemes...@googlegroups.com
Thanks for the reply. For the time being I went back to sitemesh 2. I really don't want to have to change all my pages :(
Reply all
Reply to author
Forward
0 new messages