Yes I checked with cascade attribute. That works fine. But the problem that
I'm facing is something like this:
I have index.jsp
<tiles2:insertDefinition  name="main.layout1">
<tiles2:putAttribute name="title" value="My Title"/>
</tiles2:insertDefinition>

Template1.jsp
<html>
<head>
<tiles2:insertAttribute name="body" >
  <tiles2:putAttribute name="title" value="${title}"/>
  <tiles2:putAttribute name="header" value="${header}"/>
</tiles2:insertAttribute >
</body>
</html>

When I was using Struts tiles,
I had the Template1.jsp like this

<html>
<head>
<tiles2:insertAttribute name="body" >
  <tiles:put name="title" beanName="title" beanScope="tile"/>
  <tiles:put name="header" beanName="header" beanScope="tile"/>
</tiles2:insertAttribute >
</body>
</html>
and I was trying to load index.jsp , it was loading properly.
But when I have changed it to tiles2 , it throws exception saying Caused by:
javax.servlet.ServletException: Error importing attributes. Attribute
'header' has a null value which does not happen in tiles2. 

the snippet of code from definition file:
<definition name="main.layout1" template="/templates/Template1.jsp">
</definition>




Antonio Petrelli-3 wrote:
> 
> 2009/7/6 Roshni Basu <[email protected]>:
>>
>> I have a jsp, Template1.jsp  in which I'm trying to use the new tiles2
>> tag
>> for the following pice of code,
>>  <tiles:put name="formButtonsTop" beanName="formButtonsTop"
>> beanScope="tile"/>
>> The modified piece of code is
>>  <tiles:putAttribute name="formButtonsTop" value="${formButtonsTop}"/>
> 
> I think I got it. You want to "transfer" an attribute from a template
> page to an inner page.
> This is easier to do with anonymous nested definitions:
> http://tiles.apache.org/framework/tutorial/advanced/nesting-extending.html#Anonymous_nested_definitions
> or with cascaded attributes:
> http://tiles.apache.org/framework/tutorial/advanced/nesting-extending.html#Cascaded_attributes
> However this means that you have to migrate your XML files.
> Another way is to import the attribute (through the use of
> <tiles:importAttribute>) and re-put it again.
> 
> HTH
> Antonio
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Issue-with-putAttribute-tag-tp24353360p24424271.html
Sent from the tiles users mailing list archive at Nabble.com.

Reply via email to