You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Neil Aggarwal <ne...@JAMMConsulting.com> on 2005/04/05 21:34:08 UTC

(Newbie question) tiles:getAsString error attribute not found

Hello:

I am a newbie to struts and am trying to get a handle on
tiles:getAsString tag.  I am having a problem in
that is complains that the attribute I am trying to
get does not exist.

Here is what I have in my tiles-defs.xml:

<tiles-definitions>
  <!-- Base Tiles Definition -->
  <definition name="base.definition" path="/layout.jsp">
    <put name="leftNav" value="/leftNav.jsp" />
    <put name="header" value="/header.jsp" />
    <put name="footer" value="/footer.jsp" />
  </definition>

  <!-- Tiles definition of home page -->
  <definition name="page.home" extends="base.definition">
    <put name="pageTitle" value="Welcome" />
    <put name="body" value="/home.jsp" />
  </definition>
</tiles-definitions>

I have an index.jsp that loads the page.home defintion:
<%@taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert definition="page.home" />

Here is the layout.jsp (trimmed):
<%@page language="java" %>
<%@include file="/imports.jsp" %>
<%@taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles"
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html:html locale="true">
  <body background="/images/pageBackground.gif">
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td align="right" valign="top" width="150"><tiles:insert
attribute="leftNav" /></td>
        <td valign="top"><html:img border="0" height="700"
src="/images/transparent1x1.gif" width="10" /></td>
        <td align="left" valign="top"><tiles:insert attribute="header"
/><tiles:insert attribute="body" /><tiles:insert attribute="footer" /></td>
      </tr>
    </table>
  </body>
</html:html>

Here is the header.jsp (trimmed):
<%@page language="java" %>
<%@include file="/imports.jsp" %>
<%@taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles"
%>

<table>
  <tr>
    <td class="pageTitle"><tiles:getAsString name="pageTitle" /></td>
  </tr>

When I try to load the page (You can see what I have at
http://dev.crcbusinessservices.com/crcgroup/index.jsp)

I get this error in the tomcat log:
SEVERE: ServletException in '/layout.jsp': 
ServletException in '/header.jsp': 
Error - tag.getAsString : 
attribute 'pageTitle' not found in context. Check tag syntax

Any ideas?

Thanks,
	Neil

--
Neil Aggarwal, JAMM Consulting, (972)612-6056, www.JAMMConsulting.com
FREE! Valuable info on how your business can reduce operating costs by
17% or more in 6 months or less! http://newsletter.JAMMConsulting.com


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