Search code examples
springjakarta-eespring-mvcsitemesh

Sitemesh 3. Output all body tag attributes to the layout


I have a page with:

<body class="auth_loginForm" controller="auth" action="loginForm" >

and a sitemesh layout with body:

 <body iamalayout="true" >
    <sitemesh:write property='body'/>
 </body>

Is there a way to make the attributes of the body appear on the final page?

That is the final body tag would look like:

<body iamalayout="true" class="auth_loginForm" controller="auth" action="loginForm" >

Solution

  • Try setting your layout body tag like this:

    <body iamalayout="true" <decorator:getProperty property="body.class" /> <decorator:getProperty property="body.controller" /> <decorator:getProperty property="body.action" /> >
    

    or if it's not working right try to append writeEntireProperty="true" for each decorator:getProperty tag, like

     <decorator:getProperty property="body.class" writeEntireProperty="true" />
    

    Hope it helps.

    http://wiki.sitemesh.org/wiki/display/sitemesh/Tag+References