Using the core library set variable in apache slabs

I have one page JSP template

<html>
<head></head>
<body>
    <c:set var="temp" scope="request" value="" />
    <tile:insertAttribute name="header"/>
    <tile:insertAttribute name="body"/>
    <tile:insertAttribute name="footer"/>
</body>
</html>

my xml template is below

<tiles-definitions>

    <definition name="home" extends="template">
        <put-attribute name="temp" value="home" />
        <put-attribute name="body" value="/WEB-INF/pages/home.jsp" />  
    </definition>

    <definition name="template" template="/WEB-INF/templates/template.jsp">
        <put-attribute name="temp" />
        <put-attribute name="header" value="/WEB-INF/pages/includes/header.jsp" />
        <put-attribute name="body"  />
        <put-attribute name="footer" value="/WEB-INF/pages/includes/footer.jsp" />
    </definition>
<tiles-definitions>

my question is when I set the value "home"to "temp"name in the home definition, I want to get this "home" value on the header and footer page, so I do ${temp}, but I did not find the value "home".

Is it possible? if so, how?

thanks in advance.

+4
source share
2 answers

tiles JSP tile:useAttribute. ,

<html>
<head></head>
<body>
    <c:set var="temp" scope="request"><tile:getAsString name="temp"/></c:set>
    <tile:insertAttribute name="header"/>
    <tile:insertAttribute name="body"/>
    <tile:insertAttribute name="footer"/>
</body>
</html>
+4

Jstl tiles.

<tiles:getAsString name="temp" />

<c:set var="temp" scope="request" value="" />

https://tiles.apache.org/framework/tutorial/basic/pages.html

0

All Articles