After another evening of flailing, I managed to make this work in a rather inelegant way:


In "myPageTemplate.jsp", I added this tag:

<tiles:importAttribute name="foo" scope="request"/>

and I changed "myBodyImpl.jsp" to say:

foo = <%= request.getAttribute("foo") %>

This works, but I'mnot very happy with it. Does anyone have a better solution?

-- Mike

Michael Muller wrote:


i tried this, and got the following error in my jsp:


Error - tag.getAsString : attribute 'foo' not found in context. Check tag syntax'

I had to change the tag to say

<tiles:getAsString name="foo" />

since attribute is not an attribute of getAsString.

-- Mike

Hibbs, David wrote:

Sneaky little issue on this one. Try the following...

in tiles-defs.xml change
<definition name="myTilesPageDef" path="myPageTemplate.jsp">
to
<definition name="myTilesPageDef" template="myPageTemplate.jsp">

and in myBodyImpl.jsp change
foo = <tiles:insert attribute="foo" />
to
foo = <tiles:getAsString attribute="foo" />

David Hibbs
Staff Programmer / Analyst
Distributed Applications Development and Support
American National Insurance Company


-----Original Message-----
From: Michael Muller [mailto:[EMAIL PROTECTED]
Sent: Monday, July 07, 2003 11:11 PM
To: Struts Users Mailing List
Subject: how to access tiles defs in inserted jsp ?



How do I access the value of a tiles setting from a JSP that is inserted into a template? For instance, in the following scenario, I want a rendering of "myTilesPageDef" to say "<b>foo = bar</b>", but it just says "<b>foo = </b>". I've tried some ugly hacks, which in addition to be ugly, didn't work.

Help!

Thanks,

-- Mike

tiles-defs.xml:

  <definition name="myTilesPageDef" path="myPageTemplate.jsp">
    <put name="body" value="myBodyImpl.jsp" />
    <put name="foo" value="bar" type="string" />
  </definition>

myPageTemplate.jsp:

<b><tiles:insert attribute="body" /></b>

myBodyImpl.jsp:

foo = <tiles:insert attribute="foo" />







**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************





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




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



Reply via email to