struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <brenmcgu...@tariffenet.it>
Subject Re: tile: including one layout .jsp inside another?
Date Wed, 01 Sep 2004 07:23:05 GMT
Whoops! in point 4) I meant:

  <definition name="main.usable" extends="main">
    <put name="body" value="myBody" />
  </definition>

Sorry for the mistake.
Ciao
Antonio Petrelli

brenmcguire@tariffenet.it wrote:

>Mmm... I think there is some misunderstanding in your use of Tiles.
>If I understood, maybe you want to have an effect of "panel and
>subpanels". If you want to do such a thing, you can use what I call as
>"definitions of definitions".
>If I understood (again :-P ) you want to have a main page, divided into
>three pieces (left, top and body) and the body is changin depending on
>your needs.
>1) Prepare the base definition:
>
>  <definition name="main" path="/WEB-INF/jsp/layouts/main.jsp">
>    <put name="top" value="/WEB-INF/jsp/common/top.jsp" />
>    <put name="leftNav" value="/WEB-INF/jsp/common/leftNav.jsp" />
>  </definition>
>
>2) Prepare the body layout. Suppose that you want to put only two
>attributes, one for your tabs and one for the list.
>
>bodyLayout.jsp:
>
>      <tiles:insert attribute="first" />
>      <tiles:insert attribute="second" />
>
>
>3) Prepare the body definition:
>
>  <definition name="myBody" path="/WEB-INF/jsp/layouts/bodyLayout.jsp">
>    <put name="first" value="/WEB-INF/jsp/common/first.jsp" />
>    <put name="second" value="/WEB-INF/jsp/common/second.jsp" />
>  </definition>
>
>4) Make a "definition of definition":
>
>  <definition name="main.usable" extends="main">
>    <put name="top" value="myBody" />
>  </definition>
>
>This is all you need (again, if I undestood :-P ). Anyway I wish to put a
>note aboud the "extends" attribute.
>The attribute "extends" is used to put all the missing attributes that
you
>left in a definition. For example, take this layout:
>
>  /layout/layout.jsp:
>
>  <html:html>
>    <body>
>      <tiles:insert attribute="one" />
>      <tiles:insert attribute="two" />
>      <tiles:insert attribute="three" />
>    </body>
>  </html:html>
>
>And take these definitions:
>
>  <definition name="defOne" path="/layouts/layout.jsp">
>    <put name="one" value="/tiles/one.jsp" />
>    <put name="two" value="/tiles/two.jsp" />
>  </definition>
>
>  <definition name="defTwo" extends="defOne">
>    <put name="three" value="/tiles/three.jsp" />
>  </definition>
>
>The "defOne" definition is unusable, because it misses the "three"
>attribute, but it can be used to be a base for "defTwo" definition.
>
>bill curtis wrote:
>
>>hello!!
>>
>>I have been looking high and low for an answer to this problem.
>>
>>I am trying to define a layout, one component of which is another
layout:
>>
>>
>> <definition name="main" path="/WEB-INF/jsp/layouts/main.jsp">
>>   <put name="top" value="/WEB-INF/jsp/common/top.jsp" />
>>   <put name="leftNav" value="/WEB-INF/jsp/common/leftNav.jsp" />
>> </definition>
>>
>>
>> <definition name="tabs" extends="main">
>>   <put name="body" value="/WEB-INF/jsp/foo/tabs.jsp" />
>> </definition>
>>
>> <definition name="list" extends="tabs" >
>>   <put name="view" value="/WEB-INF/jsp/foo/list.jsp" />
>> </definition>
>>
>>
>> main.jsp:
>>
>> <html:html>
>>   <body>
>>     <tiles:insert attribute="top" />
>>     <tiles:insert attribute="leftNav" />
>>     <tiles:insert attribute="body" />
>>   </body>
>> </html:html>
>>
>>
>> tabs.jsp:
>>
>> <tiles:insert attribute="view" />
>>
>>
>>When I forward to "list", main loads, it's children, including tabs,
>>but when tabs tries to load list as a child, I get this error:
>>
>> [ServletException in:/WEB-INF/jsp/foo/tabs.jsp]
>>     Error - Tag Insert : No value found for attribute 'view'.'
>>
>>
>>I have tried numerous variants of my tiles defs and tiles tags, but I
>>can't get it to work.
>>
>>Is there a way to do this?  If not, are there any recommended
>>workarounds that can be used to acheive the same effect?  Ideally,
>>tabs.jsp would not have it's component hard coded, I would like to be
>>able to select on the basis of the original forwards (which will come
>
>>from different action mappings and use different forms).
>
>>thanks & regards,
>>--bill
>>
>


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


Mime
View raw message