Eric,

If the page isn't accessed through a struts action, you need to insert the
tiles definition before your tiles:insert commands like so:
<tiles:insert definition="track.default"/>

Regads,
David

-----Original Message-----
From: Fenderbosch, Eric [mailto:[EMAIL PROTECTED]
Sent: Friday, October 10, 2003 10:39 AM
To: [EMAIL PROTECTED]
Subject: How to use tiles for Error Pages?


I've been able to use tiles for most of my pages, but how can I use it for
an error page, like 404.jsp or 500.jsp?  For my normal pages, I've declared
them in my tiles-config.xml and then the JSP is quite simple, and that is
all working fine.  Since I need to define my error pages in my web.xml, that
has no knowledge of tiles or even struts, so the error page must be complete
without a tiles definition.  How can I specify in the actually JSP to
reference/extends the track.default definition?
  <tiles-definitions>
    <definition name="track.default" path="/tiles/defaultLayout.jsp">
      <put name="titleKey" />
      <put name="header" value="/common/header.jsp"/>
      <put name="body" />
      <put name="nav" value="/common/nav.jsp"/>
      <put name="footer" value="/common/footer.jsp"/>
    </definition>
  </tiles-definitions>

I tried a 404.jsp like this:
<%@ page language="java"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:insert beanName="track.default" beanScope="request">
  <put name="titleKey" value="title.404"/>
  <put name="body">
    404
  </put>
</tiles:insert>

But I'm getting this Exception:
<Oct 10, 2003 10:34:14 AM EDT> <Error> <HTTP>
<[WebAppServletContext(244212,track,/track)] Root cause of ServletException
javax.servlet.jsp.JspException: Error - Tag Insert : No value defined for
bean 'track.default' with property 'null' in scope 'request'.
        at
org.apache.struts.taglib.tiles.InsertTag.processBean(InsertTag.java:667)
        at
org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:491
)
        at
org.apache.struts.taglib.tiles.InsertTag.doStartTag(InsertTag.java:451)
        at jsp_servlet.__404._jspService(__404.java:106)

I'm confused as where to look next.  Any help would be appreciated.

Thanks.

Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to