That didn't work. First I got a ClassCastException because its actually of type org.apache.struts.tiles.DirectStringAttribute and not java.lang.string. Even after I adjusted for that, however, I still was not able to see nav_key or local_nav_key in samplecontent.jsp.

That tiles reference was very helpful though. It said that all attributes are defined in the "tiles" scope only and are not visible to sub-tiles. That gave me the idea to redefine the variable into the request scope. So this is what I did:

in headerContentFooter.jsp:
<bean:define id="nav_key" name="nav_key" toScope="request" />

then in samplecontent.jsp:
<bean:define name="nav_key" scope="request" ignore="true"/>

and that works. Thanks!


Christopher C Worley wrote:
Frank,

Try this in headerContentFooter.jsp

<tiles:useAttribute id="local_nav_key" name="nav_key" classname="java.lang.String" ignore="true" />
<p>nav_key = <%=local_nav_key%></p>


Here is a good reference for tiles

http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf



-chris worley

Hi all, I'm having a problem passing a parameter down from a tiles definition to a jsp. I can access the value easily in the layout definition, but I can't get access to it in a file (or action) I'm inserting into the layout. Here is an example of what I'm doing (cut down a bit)

tiles.xml:
<definition name="mp.main" path="/tiles/layout/headerContentFooter.jsp">
  <put name="nav_key"    value="mp" type="string"/>
  <put name="content"    value="/showcontent.do" />
</definition>

headerContentFooter.jsp:
<tiles:useAttribute name="nav_key" />
<p>nav_key = <%=nav_key%><p>
<tiles:insert attribute="content" />

samplecontent.jsp:
<bean:define id="nav_key" name="nav_key" />
<b>nav_key::: <%=nav_key%></b>

So I'm getting an error in samplecontent.jsp that there is no such variable in any scope. How can I get it? I can print out the value fine in the headerContentFooter layout. I also tried adding a <tiles:useAttribute> in samplecontent.jsp to try and get access to the variable but that didn't work either. Any help would be appreciated.

Thanks!





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


-- Frank Maritato


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to