struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "List Mailbox" <cal...@holview.com>
Subject RE: problems with tiles:getAsString in nested tiles?
Date Tue, 02 Dec 2003 00:44:21 GMT
The easiest way is to declare a bean and scope for the request - that way
the other jsps have a chance to use the attribute.  The tiles attributes are
only scoped (TilesContext) for the testpage.jsp declared in the path=
attribute in the first definition when using the getAsString.

Try this at the top of the template - testpage.jsp.
<tiles:useAttribute id="title" name="title" scope="request"/>

your mainLayout.jsp will be able to use the title if you reference the bean
in the jsp:
<bean:message name="title" scope="request"/>

Cal
www.calandva.com

-----Original Message-----
From: struts-user-return-100272-calvin=holview.com@jakarta.apache.org
[mailto:struts-user-return-100272-calvin=holview.com@jakarta.apache.org]On
Behalf Of Green, Noah
Sent: Friday, November 28, 2003 8:11 PM
To: 'struts-user@jakarta.apache.org'
Subject: problems with tiles:getAsString in nested tiles?


Hi,
Sorry to bother you all, I've looked thru the archives and seen some similar
threads, but without any clear conclusions.
I'm using a <tiles:getAsString . . . > element in a nested tile, and I'm
getting the following error:

ServletException in:/jsp/layout/mainLayout.jsp] Error - tag.getAsString :
attribute 'title' not found in context. Check tag syntax'

However, this same element works in a tile that is nested at the "top
level".


Here is my tiles-defs.xml:
   <definition name=".testpage"   path="/jsp/testpage.jsp">
      <put     name="title"  value=""/>
      <put     name="body"   value=""/>
   </definition>

   <definition name=".testpage.main"     extends=".testpage">
      <put     name="title"         value="This is my title" />
      <put     name="body"          value="/jsp/layout/mainLayout.jsp" />
   </definition>


Here is my testpage.jsp, where the <tiles:getAsString ....> does work:
  <html-el:html>
     <head>
        <title><tiles:getAsString name="title" /></title>
     </head>

     <body bgColor="white">
        <tiles:get name="body" />
     </body>
  </html-el:html>

Here is my mainLayout.jsp, where the <tiles:getAsString ...> is failing:
  <h2><tiles:getAsString name="title" /></h2>


The end result is that when I use a ForwardAction to go to ".testpage.main",

the <title> element in the page header is populated correctly, but the call
to
populated the <h2> area fails with the exception.

Any help on why this is happening is much appreciated :-)

Thanks!
Noah



Noah Green
LEHMAN BROTHERS, Inc.
Fixed Income Analytics
email: noah.green@lehman.com
pager: ngreen_lehman@imcingular.com
work: 212.526.1689
cellular: 917.406.4930
fax: 646.758.2306



----------------------------------------------------------------------------
--
This message is intended only for the personal and confidential use of the
designated recipient(s) named above.  If you are not the intended recipient
of
this message you are hereby notified that any review, dissemination,
distribution or copying of this message is strictly prohibited.  This
communication is for information purposes only and should not be regarded as
an offer to sell or as a solicitation of an offer to buy any financial
product, an official confirmation of any transaction, or as an official
statement of Lehman Brothers.  Email transmission cannot be guaranteed to be
secure or error-free.  Therefore, we do not represent that this information
is
complete or accurate and it should not be relied upon as such.  All
information is subject to change without notice.


---------------------------------------------------------------------
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