You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Michael Heinen <mi...@recommind.com> on 2010/01/03 17:45:24 UTC

migration to tiles2 - put attribute into request scope?

Hi,

I migrated a webApp from tiles1 to tiles 2.0.5 and got one thing not working.
I cannot put an attribute into request scope to make it accessible by other frameworks.

Sample code is below: It is the attribute with name=activeTab, which should be accessible in navigation.jsp.

tiles 1:
<definition name=".mainLayout" path="/WEB-INF/layout/main.jsp">
    <put name="header" value="/WEB-INF/layout/header.jsp"/>
    <put name="navigation" value="/pages/empty.jsp"/>
    <put name="content" value="/pages/empty.jsp"/>
    <put name="activeTab" value=""/>
</definition>

<definition name="/batches.tiles" extends=".mainLayout">
    <put name="navigation" value="/WEB-INF/layout/navigation.jsp"/>
    <put name="content" value="/pages/bcontent.jsp"/>
    <put name="activeTab" value="ba"/>
</definition>

main.jsp:
<tiles:insert attribute="navigation" flush="false" ignore="false">
  <tiles:put name="activeTab" beanName="activeTab"/>
</tiles:insert>

navigation.jsp
<tiles:useAttribute id="activeTab" name="activeTab" ignore="true" classname="java.lang.String" scope="request"/>


tiles2:
<definition name=".mainLayout" template="/WEB-INF/layout/main.jsp">
    <put-attribute name="header" value="/WEB-INF/layout/header.jsp"/>
    <put-attribute name="navigation" value="/pages/empty.jsp"/>
    <put-attribute name="content" value="/pages/empty.jsp"/>
    <put-attribute name="activeTab" value=""/>
</definition>

<definition name="/batches.tiles" extends=".mainLayout">
    <put-attribute name="navigation" value="/WEB-INF/layout/navigation.jsp"/>
    <put-attribute name="content" value="/pages/bcontent.jsp"/>
    <put-attribute name="activeTab" value="ba"/>
</definition>

main.jsp:
<tiles:insertAttribute name="navigation" flush="false" ignore="false">
  <tiles:putAttribute name="activeTab" value="activeTab"/>
</tiles:insertAttribute>

navigation.jsp
<tiles:useAttribute id="activeTab" name="activeTab" ignore="true" classname="java.lang.String" scope="request"/>

How can I place the content of activeTab (here "ba") into request scope to make it accessible by other frameworks?
Currently the String "activeTab" is passed but I want to pass "ba".

Sorry for crossposting this also to the struts list, email was sent too fast with auto completion of recipient.

Thanks,
Michael


RE: migration to tiles2 - put attribute into request scope?

Posted by Michael Heinen <mi...@recommind.com>.
Got it working with an additional import statement:

Main.jsp
<tiles:importAttribute  name="activeTab" scope="request"/>
<tiles:insertAttribute name="navigation" flush="false" ignore="false"/>

<tiles:useAttribute is also not required any more in navigation.jsp.

Michael


-----Original Message-----
From: Michael Heinen [mailto:michael.heinen@recommind.com] 
Sent: Sonntag, 3. Januar 2010 17:45
To: users@tiles.apache.org
Subject: migration to tiles2 - put attribute into request scope?

Hi,

I migrated a webApp from tiles1 to tiles 2.0.5 and got one thing not working.
I cannot put an attribute into request scope to make it accessible by other frameworks.

Sample code is below: It is the attribute with name=activeTab, which should be accessible in navigation.jsp.

tiles 1:
<definition name=".mainLayout" path="/WEB-INF/layout/main.jsp">
    <put name="header" value="/WEB-INF/layout/header.jsp"/>
    <put name="navigation" value="/pages/empty.jsp"/>
    <put name="content" value="/pages/empty.jsp"/>
    <put name="activeTab" value=""/>
</definition>

<definition name="/batches.tiles" extends=".mainLayout">
    <put name="navigation" value="/WEB-INF/layout/navigation.jsp"/>
    <put name="content" value="/pages/bcontent.jsp"/>
    <put name="activeTab" value="ba"/>
</definition>

main.jsp:
<tiles:insert attribute="navigation" flush="false" ignore="false">
  <tiles:put name="activeTab" beanName="activeTab"/>
</tiles:insert>

navigation.jsp
<tiles:useAttribute id="activeTab" name="activeTab" ignore="true" classname="java.lang.String" scope="request"/>


tiles2:
<definition name=".mainLayout" template="/WEB-INF/layout/main.jsp">
    <put-attribute name="header" value="/WEB-INF/layout/header.jsp"/>
    <put-attribute name="navigation" value="/pages/empty.jsp"/>
    <put-attribute name="content" value="/pages/empty.jsp"/>
    <put-attribute name="activeTab" value=""/>
</definition>

<definition name="/batches.tiles" extends=".mainLayout">
    <put-attribute name="navigation" value="/WEB-INF/layout/navigation.jsp"/>
    <put-attribute name="content" value="/pages/bcontent.jsp"/>
    <put-attribute name="activeTab" value="ba"/>
</definition>

main.jsp:
<tiles:insertAttribute name="navigation" flush="false" ignore="false">
  <tiles:putAttribute name="activeTab" value="activeTab"/>
</tiles:insertAttribute>

navigation.jsp
<tiles:useAttribute id="activeTab" name="activeTab" ignore="true" classname="java.lang.String" scope="request"/>

How can I place the content of activeTab (here "ba") into request scope to make it accessible by other frameworks?
Currently the String "activeTab" is passed but I want to pass "ba".

Sorry for crossposting this also to the struts list, email was sent too fast with auto completion of recipient.

Thanks,
Michael