You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ed Dowgiallo <ed...@ptdprolog.net> on 2003/11/21 19:06:37 UTC

Inheritance in tile definition files I

I'm having a little trouble with the tile definition files after working through the tutorial.  As a simple example of what I am hitting, I get the error message:

javax.servlet.jsp.JspException: Error - tag useAttribute : attribute 'title' not found in context. Check tag syntax

	at org.apache.struts.taglib.tiles.UseAttributeTag.doStartTag(UseAttributeTag.java:225)

	at _common._header._jspService(_header.java:50)

	[SRC:/common/header.jsp:21]

The relevant section of my definition file looks like this:

  <!-- ===================================================================== -->
  <!--                                                                       -->
  <!-- Form Layout                                                           -->
  <!--                                                                       -->
  <!-- ===================================================================== -->
  <definition name="form.layout" page="/layouts/formLayout.jsp">
    <put name="system-short-name" value="TDL"/>
    <put name="user-name" value="Guest"/>
    <put name="title"   value="Form Page Layout"/>
    <put name="header"  value="/common/header.jsp"/>
    <put name="content" value="${content}"/>
    <put name="footer"  value="/common/footer.jsp"/>
  </definition>
  <!-- ===================================================================== -->
  <!--                                                                       -->
  <!-- Security Module Pages                                                 -->
  <!--                                                                       -->
  <!-- ===================================================================== -->
  <definition name="login.form" extends="form.layout">
    <put name="title"   value="Login Form"/>
    <put name="content" value="/security/login.jsp"/>
  </definition>

header.jsp contains the following:

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="tiles" uri="/WEB-INF/struts-tiles.tld"%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">

...

  <tr class="banner">
        <td width="3"></td>
        <td class="system-name" align="left" width="80%">
          <span class="banner-value">TDL&#160;</span>
          <span class="page-title"><tiles:getAsString name="title"/></span>
        </td>

...

Comments and suggestions would be greatly appreciated.
Ed

Re: Inheritance in tile definition files I

Posted by Mark Lowe <ma...@talk21.com>.
You'll hear a lot of shit talked about tiles.

This article explains the lot

http://www.javaworld.com/javaworld/jw-01-2002/jw-0104-tilestrut.html

I use the Tiles inheritance solution. Saves all those jsp's with  
forwards and redirects. The secret is that you always need to us an  
action

<action path="/foo" forward="my.tiledef" /> wont work

<action path="/foo" type="com.sparrow.BlankAction">
	<forward name="success" path="my.tiledef" />
</action> will work (assuming you've an action that returns success.

The only one I use is to start the application.

<c:redirect url="/Start.do" />

Anyway read the article, it should help you.

Cheers Mark


On 22 Nov 2003, at 16:07, Ed Dowgiallo wrote:

> Upon changing from logic:forward to
>
>   <body>
>     <logic:redirect forward="welcome"/>
>   </body>
>
> I'm getting the same error message.
>
> javax.servlet.jsp.JspException: Error - tag useAttribute : attribute  
> 'title' not found in context. Check tag syntax
>
> Please excuse my seeming a little thick about this.  If I want the  
> first form in my application to be generated from a tiles definition  
> file, I must do all of the following?
>   a.. Since a struts action is not a valid URL target, I need a  
> welcome.jsp type file that contains either a <logic:forward> or a  
> <logic:redirect>
>   b.. Since a tiles definition file entry is not a valid target for a  
> struts global forward, I need to subclass the Action class and forward  
> from there.
>   c.. This means that my welcome.jsp file will forward to a global  
> forward, which will forward to an action which will forward to the  
> actual tile definition file form.
> Do I understand what is needed correctly?
>
> Is there any plan to simplify this in Struts 1.2?
>
> Thank you,
> Ed
> ----- Original Message -----
> From: "David Friedman" <hu...@ix.netcom.com>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Friday, November 21, 2003 2:40 PM
> Subject: RE: Inheritance in tile definition files I
>
>
>> Ed,
>>
>> I wrote about this back in August, at that time,
>> Struts 1.0 had a limitation with logic:forwards
>> (see below).  The v1.1 production release says the
>> same thing:
>>
>>> The logical name of the global ActionForward entry
>>> that identifies the destination, and forwarding
>>> approach, to be used. Note: forwarding to Tiles
>>> definitions is not supported from this tag. You
>>> should forward to them from an Action subclass.
>>
>> http://jakarta.apache.org/struts/userGuide/struts-logic.html
>>
>> A logic:redirect would be better so it goes outside
>> and does a new request for that page.  I'd recommend
>> an ActionForward class, but, if you go directly to
>> the page, heed my "tiles:insert definition=" note
>> below.
>>
>> Regards,
>> David
>>
>> -----Original Message-----
>> From: Ed Dowgiallo [mailto:edowgial@ptdprolog.net]
>> Sent: Friday, November 21, 2003 2:12 PM
>> To: Struts Users Mailing List
>> Subject: Re: Inheritance in tile definition files I
>>
>>
>> I get to the JSP by forwarding from a non-Struts JSP.  There do not  
>> appear
>> to be any tiles loading errors.
>>
>> From welcome.jsp:
>>
>> <%@ page contentType="text/html;charset=UTF-8"%>
>> <%@ taglib prefix="logic" uri="/WEB-INF/struts-logic.tld"%>
>> <html>
>>   <body>
>>     <logic:forward name="welcome"/>
>>   </body>
>> </html>
>>
>> From struts-config.xml:
>>
>>   <global-forwards>
>>     <forward name="welcome" path="/loginForm.do"/>
>>   </global-forwards>
>>
>>   <action-mappings>
>>     <action path="/loginForm" parameter="login.form" name="loginForm"
>> validate="false" scope="request"
>> type="org.apache.struts.actions.ForwardAction"/>
>>   </action-mappings>
>>
>> Thank you,
>> Ed
>> ----- Original Message -----
>> From: "David Friedman" <hu...@ix.netcom.com>
>> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
>> Sent: Friday, November 21, 2003 1:22 PM
>> Subject: RE: Inheritance in tile definition files I
>>
>>
>>> How do you get to your JSP?  Do you use and action?  If so, are you  
>>> using
>>> 'path="login.form"' or 'path="form.layout"' and do you see any tiles
>> loading
>>> errors?
>>>
>>> Are you getting to your JSP directly from the outside world (not  
>>> through
>> an
>>> action's mapping)?  If so, you need to first load your tile  
>>> definition in
>>> your main JSP by using
>>> <tiles:insert definition="some.tiles.definition.name"/>
>>>
>>> Regards,
>>>
>>> David
>>>
>>>   -----Original Message-----
>>>   From: Ed Dowgiallo [mailto:edowgial@ptdprolog.net]
>>>   Sent: Friday, November 21, 2003 1:07 PM
>>>   To: struts-user@jakarta.apache.org
>>>   Subject: Inheritance in tile definition files I
>>>
>>>
>>>   I'm having a little trouble with the tile definition files after  
>>> working
>>> through the tutorial.  As a simple example of what I am hitting, I  
>>> get the
>>> error message:
>>>
>>>   javax.servlet.jsp.JspException: Error - tag useAttribute :  
>>> attribute
>>> 'title' not found in context. Check tag syntax
>>>
>>>   at
>>>
>> org.apache.struts.taglib.tiles.UseAttributeTag.doStartTag(UseAttribute 
>> Tag.ja
>>> va:225)
>>>
>>>   at _common._header._jspService(_header.java:50)
>>>
>>>   [SRC:/common/header.jsp:21]
>>>
>>>   The relevant section of my definition file looks like this:
>>>
>>>     <!--
>>> ===================================================================== 
>>>  -->
>>>
>>>         -->
>>>     <!-- Form
>>>        -->
>>>
>>>         -->
>>>     <!--
>>> ===================================================================== 
>>>  -->
>>>     <definition name="form.layout" page="/layouts/formLayout.jsp">
>>>       <put name="system-short-name" value="TDL"/>
>>>       <put name="user-name" value="Guest"/>
>>>       <put name="title"   value="Form Page Layout"/>
>>>       <put name="header"  value="/common/header.jsp"/>
>>>       <put name="content" value="${content}"/>
>>>       <put name="footer"  value="/common/footer.jsp"/>
>>>     </definition>
>>>     <!--
>>> ===================================================================== 
>>>  -->
>>>
>>>         -->
>>>     <!-- Security Module
>>>       -->
>>>
>>>         -->
>>>     <!--
>>> ===================================================================== 
>>>  -->
>>>     <definition name="login.form" extends="form.layout">
>>>       <put name="title"   value="Login Form"/>
>>>       <put name="content" value="/security/login.jsp"/>
>>>     </definition>
>>>
>>>   header.jsp contains the following:
>>>
>>>   <%@ page contentType="text/html;charset=UTF-8"%>
>>>   <%@ taglib prefix="tiles" uri="/WEB-INF/struts-tiles.tld"%>
>>>   <table width="100%" border="0" cellspacing="0" cellpadding="0">
>>>
>>>   ...
>>>
>>>     <tr class="banner">
>>>           <td width="3"></td>
>>>           <td class="system-name" align="left" width="80%">
>>>             <span class="banner-value">TDL&#160;</span>
>>>             <span class="page-title"><tiles:getAsString
>>> name="title"/></span>
>>>           </td>
>>>
>>>   ...
>>>
>>>   Comments and suggestions would be greatly appreciated.
>>>   Ed
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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


Re: Inheritance in tile definition files I

Posted by Ed Dowgiallo <ed...@ptdprolog.net>.
Upon changing from logic:forward to

  <body>
    <logic:redirect forward="welcome"/>
  </body>

I'm getting the same error message.

javax.servlet.jsp.JspException: Error - tag useAttribute : attribute 'title' not found in context. Check tag syntax

Please excuse my seeming a little thick about this.  If I want the first form in my application to be generated from a tiles definition file, I must do all of the following?
  a.. Since a struts action is not a valid URL target, I need a welcome.jsp type file that contains either a <logic:forward> or a <logic:redirect>
  b.. Since a tiles definition file entry is not a valid target for a struts global forward, I need to subclass the Action class and forward from there.
  c.. This means that my welcome.jsp file will forward to a global forward, which will forward to an action which will forward to the actual tile definition file form.
Do I understand what is needed correctly?

Is there any plan to simplify this in Struts 1.2?

Thank you,
Ed
----- Original Message ----- 
From: "David Friedman" <hu...@ix.netcom.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, November 21, 2003 2:40 PM
Subject: RE: Inheritance in tile definition files I


> Ed,
> 
> I wrote about this back in August, at that time,
> Struts 1.0 had a limitation with logic:forwards
> (see below).  The v1.1 production release says the
> same thing:
> 
> > The logical name of the global ActionForward entry
> > that identifies the destination, and forwarding
> > approach, to be used. Note: forwarding to Tiles
> > definitions is not supported from this tag. You
> > should forward to them from an Action subclass.
> 
> http://jakarta.apache.org/struts/userGuide/struts-logic.html
> 
> A logic:redirect would be better so it goes outside
> and does a new request for that page.  I'd recommend
> an ActionForward class, but, if you go directly to
> the page, heed my "tiles:insert definition=" note
> below.
> 
> Regards,
> David
> 
> -----Original Message-----
> From: Ed Dowgiallo [mailto:edowgial@ptdprolog.net]
> Sent: Friday, November 21, 2003 2:12 PM
> To: Struts Users Mailing List
> Subject: Re: Inheritance in tile definition files I
> 
> 
> I get to the JSP by forwarding from a non-Struts JSP.  There do not appear
> to be any tiles loading errors.
> 
> From welcome.jsp:
> 
> <%@ page contentType="text/html;charset=UTF-8"%>
> <%@ taglib prefix="logic" uri="/WEB-INF/struts-logic.tld"%>
> <html>
>   <body>
>     <logic:forward name="welcome"/>
>   </body>
> </html>
> 
> From struts-config.xml:
> 
>   <global-forwards>
>     <forward name="welcome" path="/loginForm.do"/>
>   </global-forwards>
> 
>   <action-mappings>
>     <action path="/loginForm" parameter="login.form" name="loginForm"
> validate="false" scope="request"
> type="org.apache.struts.actions.ForwardAction"/>
>   </action-mappings>
> 
> Thank you,
> Ed
> ----- Original Message -----
> From: "David Friedman" <hu...@ix.netcom.com>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Friday, November 21, 2003 1:22 PM
> Subject: RE: Inheritance in tile definition files I
> 
> 
> > How do you get to your JSP?  Do you use and action?  If so, are you using
> > 'path="login.form"' or 'path="form.layout"' and do you see any tiles
> loading
> > errors?
> >
> > Are you getting to your JSP directly from the outside world (not through
> an
> > action's mapping)?  If so, you need to first load your tile definition in
> > your main JSP by using
> > <tiles:insert definition="some.tiles.definition.name"/>
> >
> > Regards,
> >
> > David
> >
> >   -----Original Message-----
> >   From: Ed Dowgiallo [mailto:edowgial@ptdprolog.net]
> >   Sent: Friday, November 21, 2003 1:07 PM
> >   To: struts-user@jakarta.apache.org
> >   Subject: Inheritance in tile definition files I
> >
> >
> >   I'm having a little trouble with the tile definition files after working
> > through the tutorial.  As a simple example of what I am hitting, I get the
> > error message:
> >
> >   javax.servlet.jsp.JspException: Error - tag useAttribute : attribute
> > 'title' not found in context. Check tag syntax
> >
> >   at
> >
> org.apache.struts.taglib.tiles.UseAttributeTag.doStartTag(UseAttributeTag.ja
> > va:225)
> >
> >   at _common._header._jspService(_header.java:50)
> >
> >   [SRC:/common/header.jsp:21]
> >
> >   The relevant section of my definition file looks like this:
> >
> >     <!--
> > ===================================================================== -->
> >
> >         -->
> >     <!-- Form
> >        -->
> >
> >         -->
> >     <!--
> > ===================================================================== -->
> >     <definition name="form.layout" page="/layouts/formLayout.jsp">
> >       <put name="system-short-name" value="TDL"/>
> >       <put name="user-name" value="Guest"/>
> >       <put name="title"   value="Form Page Layout"/>
> >       <put name="header"  value="/common/header.jsp"/>
> >       <put name="content" value="${content}"/>
> >       <put name="footer"  value="/common/footer.jsp"/>
> >     </definition>
> >     <!--
> > ===================================================================== -->
> >
> >         -->
> >     <!-- Security Module
> >       -->
> >
> >         -->
> >     <!--
> > ===================================================================== -->
> >     <definition name="login.form" extends="form.layout">
> >       <put name="title"   value="Login Form"/>
> >       <put name="content" value="/security/login.jsp"/>
> >     </definition>
> >
> >   header.jsp contains the following:
> >
> >   <%@ page contentType="text/html;charset=UTF-8"%>
> >   <%@ taglib prefix="tiles" uri="/WEB-INF/struts-tiles.tld"%>
> >   <table width="100%" border="0" cellspacing="0" cellpadding="0">
> >
> >   ...
> >
> >     <tr class="banner">
> >           <td width="3"></td>
> >           <td class="system-name" align="left" width="80%">
> >             <span class="banner-value">TDL&#160;</span>
> >             <span class="page-title"><tiles:getAsString
> > name="title"/></span>
> >           </td>
> >
> >   ...
> >
> >   Comments and suggestions would be greatly appreciated.
> >   Ed
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 

RE: Inheritance in tile definition files I

Posted by David Friedman <hu...@ix.netcom.com>.
Ed,

I wrote about this back in August, at that time,
Struts 1.0 had a limitation with logic:forwards
(see below).  The v1.1 production release says the
same thing:

> The logical name of the global ActionForward entry
> that identifies the destination, and forwarding
> approach, to be used. Note: forwarding to Tiles
> definitions is not supported from this tag. You
> should forward to them from an Action subclass.

http://jakarta.apache.org/struts/userGuide/struts-logic.html

A logic:redirect would be better so it goes outside
and does a new request for that page.  I'd recommend
an ActionForward class, but, if you go directly to
the page, heed my "tiles:insert definition=" note
below.

Regards,
David

-----Original Message-----
From: Ed Dowgiallo [mailto:edowgial@ptdprolog.net]
Sent: Friday, November 21, 2003 2:12 PM
To: Struts Users Mailing List
Subject: Re: Inheritance in tile definition files I


I get to the JSP by forwarding from a non-Struts JSP.  There do not appear
to be any tiles loading errors.

>From welcome.jsp:

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="logic" uri="/WEB-INF/struts-logic.tld"%>
<html>
  <body>
    <logic:forward name="welcome"/>
  </body>
</html>

>From struts-config.xml:

  <global-forwards>
    <forward name="welcome" path="/loginForm.do"/>
  </global-forwards>

  <action-mappings>
    <action path="/loginForm" parameter="login.form" name="loginForm"
validate="false" scope="request"
type="org.apache.struts.actions.ForwardAction"/>
  </action-mappings>

Thank you,
Ed
----- Original Message -----
From: "David Friedman" <hu...@ix.netcom.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, November 21, 2003 1:22 PM
Subject: RE: Inheritance in tile definition files I


> How do you get to your JSP?  Do you use and action?  If so, are you using
> 'path="login.form"' or 'path="form.layout"' and do you see any tiles
loading
> errors?
>
> Are you getting to your JSP directly from the outside world (not through
an
> action's mapping)?  If so, you need to first load your tile definition in
> your main JSP by using
> <tiles:insert definition="some.tiles.definition.name"/>
>
> Regards,
>
> David
>
>   -----Original Message-----
>   From: Ed Dowgiallo [mailto:edowgial@ptdprolog.net]
>   Sent: Friday, November 21, 2003 1:07 PM
>   To: struts-user@jakarta.apache.org
>   Subject: Inheritance in tile definition files I
>
>
>   I'm having a little trouble with the tile definition files after working
> through the tutorial.  As a simple example of what I am hitting, I get the
> error message:
>
>   javax.servlet.jsp.JspException: Error - tag useAttribute : attribute
> 'title' not found in context. Check tag syntax
>
>   at
>
org.apache.struts.taglib.tiles.UseAttributeTag.doStartTag(UseAttributeTag.ja
> va:225)
>
>   at _common._header._jspService(_header.java:50)
>
>   [SRC:/common/header.jsp:21]
>
>   The relevant section of my definition file looks like this:
>
>     <!--
> ===================================================================== -->
>
>         -->
>     <!-- Form
>        -->
>
>         -->
>     <!--
> ===================================================================== -->
>     <definition name="form.layout" page="/layouts/formLayout.jsp">
>       <put name="system-short-name" value="TDL"/>
>       <put name="user-name" value="Guest"/>
>       <put name="title"   value="Form Page Layout"/>
>       <put name="header"  value="/common/header.jsp"/>
>       <put name="content" value="${content}"/>
>       <put name="footer"  value="/common/footer.jsp"/>
>     </definition>
>     <!--
> ===================================================================== -->
>
>         -->
>     <!-- Security Module
>       -->
>
>         -->
>     <!--
> ===================================================================== -->
>     <definition name="login.form" extends="form.layout">
>       <put name="title"   value="Login Form"/>
>       <put name="content" value="/security/login.jsp"/>
>     </definition>
>
>   header.jsp contains the following:
>
>   <%@ page contentType="text/html;charset=UTF-8"%>
>   <%@ taglib prefix="tiles" uri="/WEB-INF/struts-tiles.tld"%>
>   <table width="100%" border="0" cellspacing="0" cellpadding="0">
>
>   ...
>
>     <tr class="banner">
>           <td width="3"></td>
>           <td class="system-name" align="left" width="80%">
>             <span class="banner-value">TDL&#160;</span>
>             <span class="page-title"><tiles:getAsString
> name="title"/></span>
>           </td>
>
>   ...
>
>   Comments and suggestions would be greatly appreciated.
>   Ed
>


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


Re: Inheritance in tile definition files I

Posted by Ed Dowgiallo <ed...@ptdprolog.net>.
I get to the JSP by forwarding from a non-Struts JSP.  There do not appear to be any tiles loading errors.

>From welcome.jsp:

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="logic" uri="/WEB-INF/struts-logic.tld"%>
<html>
  <body>
    <logic:forward name="welcome"/>
  </body>
</html>

>From struts-config.xml:

  <global-forwards>
    <forward name="welcome" path="/loginForm.do"/>
  </global-forwards>

  <action-mappings>
    <action path="/loginForm" parameter="login.form" name="loginForm" validate="false" scope="request" type="org.apache.struts.actions.ForwardAction"/>
  </action-mappings>

Thank you,
Ed
----- Original Message ----- 
From: "David Friedman" <hu...@ix.netcom.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, November 21, 2003 1:22 PM
Subject: RE: Inheritance in tile definition files I


> How do you get to your JSP?  Do you use and action?  If so, are you using
> 'path="login.form"' or 'path="form.layout"' and do you see any tiles loading
> errors?
> 
> Are you getting to your JSP directly from the outside world (not through an
> action's mapping)?  If so, you need to first load your tile definition in
> your main JSP by using
> <tiles:insert definition="some.tiles.definition.name"/>
> 
> Regards,
> 
> David
> 
>   -----Original Message-----
>   From: Ed Dowgiallo [mailto:edowgial@ptdprolog.net]
>   Sent: Friday, November 21, 2003 1:07 PM
>   To: struts-user@jakarta.apache.org
>   Subject: Inheritance in tile definition files I
> 
> 
>   I'm having a little trouble with the tile definition files after working
> through the tutorial.  As a simple example of what I am hitting, I get the
> error message:
> 
>   javax.servlet.jsp.JspException: Error - tag useAttribute : attribute
> 'title' not found in context. Check tag syntax
> 
>   at
> org.apache.struts.taglib.tiles.UseAttributeTag.doStartTag(UseAttributeTag.ja
> va:225)
> 
>   at _common._header._jspService(_header.java:50)
> 
>   [SRC:/common/header.jsp:21]
> 
>   The relevant section of my definition file looks like this:
> 
>     <!--
> ===================================================================== -->
> 
>         -->
>     <!-- Form
>        -->
> 
>         -->
>     <!--
> ===================================================================== -->
>     <definition name="form.layout" page="/layouts/formLayout.jsp">
>       <put name="system-short-name" value="TDL"/>
>       <put name="user-name" value="Guest"/>
>       <put name="title"   value="Form Page Layout"/>
>       <put name="header"  value="/common/header.jsp"/>
>       <put name="content" value="${content}"/>
>       <put name="footer"  value="/common/footer.jsp"/>
>     </definition>
>     <!--
> ===================================================================== -->
> 
>         -->
>     <!-- Security Module
>       -->
> 
>         -->
>     <!--
> ===================================================================== -->
>     <definition name="login.form" extends="form.layout">
>       <put name="title"   value="Login Form"/>
>       <put name="content" value="/security/login.jsp"/>
>     </definition>
> 
>   header.jsp contains the following:
> 
>   <%@ page contentType="text/html;charset=UTF-8"%>
>   <%@ taglib prefix="tiles" uri="/WEB-INF/struts-tiles.tld"%>
>   <table width="100%" border="0" cellspacing="0" cellpadding="0">
> 
>   ...
> 
>     <tr class="banner">
>           <td width="3"></td>
>           <td class="system-name" align="left" width="80%">
>             <span class="banner-value">TDL&#160;</span>
>             <span class="page-title"><tiles:getAsString
> name="title"/></span>
>           </td>
> 
>   ...
> 
>   Comments and suggestions would be greatly appreciated.
>   Ed
> 

RE: Inheritance in tile definition files I

Posted by David Friedman <hu...@ix.netcom.com>.
How do you get to your JSP?  Do you use and action?  If so, are you using
'path="login.form"' or 'path="form.layout"' and do you see any tiles loading
errors?

Are you getting to your JSP directly from the outside world (not through an
action's mapping)?  If so, you need to first load your tile definition in
your main JSP by using
<tiles:insert definition="some.tiles.definition.name"/>

Regards,

David

  -----Original Message-----
  From: Ed Dowgiallo [mailto:edowgial@ptdprolog.net]
  Sent: Friday, November 21, 2003 1:07 PM
  To: struts-user@jakarta.apache.org
  Subject: Inheritance in tile definition files I


  I'm having a little trouble with the tile definition files after working
through the tutorial.  As a simple example of what I am hitting, I get the
error message:

  javax.servlet.jsp.JspException: Error - tag useAttribute : attribute
'title' not found in context. Check tag syntax

  at
org.apache.struts.taglib.tiles.UseAttributeTag.doStartTag(UseAttributeTag.ja
va:225)

  at _common._header._jspService(_header.java:50)

  [SRC:/common/header.jsp:21]

  The relevant section of my definition file looks like this:

    <!--
===================================================================== -->

        -->
    <!-- Form
       -->

        -->
    <!--
===================================================================== -->
    <definition name="form.layout" page="/layouts/formLayout.jsp">
      <put name="system-short-name" value="TDL"/>
      <put name="user-name" value="Guest"/>
      <put name="title"   value="Form Page Layout"/>
      <put name="header"  value="/common/header.jsp"/>
      <put name="content" value="${content}"/>
      <put name="footer"  value="/common/footer.jsp"/>
    </definition>
    <!--
===================================================================== -->

        -->
    <!-- Security Module
      -->

        -->
    <!--
===================================================================== -->
    <definition name="login.form" extends="form.layout">
      <put name="title"   value="Login Form"/>
      <put name="content" value="/security/login.jsp"/>
    </definition>

  header.jsp contains the following:

  <%@ page contentType="text/html;charset=UTF-8"%>
  <%@ taglib prefix="tiles" uri="/WEB-INF/struts-tiles.tld"%>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">

  ...

    <tr class="banner">
          <td width="3"></td>
          <td class="system-name" align="left" width="80%">
            <span class="banner-value">TDL&#160;</span>
            <span class="page-title"><tiles:getAsString
name="title"/></span>
          </td>

  ...

  Comments and suggestions would be greatly appreciated.
  Ed