struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Muller <mmul...@theworld.com>
Subject Re: how to access tiles defs in inserted jsp ?
Date Wed, 09 Jul 2003 06:26:00 GMT

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:mmuller@theworld.com]
>>> 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: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message