File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Passing Tiles into an IFRAME. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Passing Tiles into an IFRAME." Watch "Passing Tiles into an IFRAME." New topic

Passing Tiles into an IFRAME.

bryan nelson
Ranch Hand

Joined: Jun 16, 2003
Posts: 95
Good morning.

I am currently in need of creating a page with a solid banner at the top of the page that never moves...with a regular website below it. We're using Struts 1.1 and Tiles and I'm having trouble getting these technologies to merge.

The idea is that we'd have an html page that holds a table up top (the banner), and an iframe on the bottom. The table would be static and would always stay on the page, and the iframe, due to its nature, would be scrollable below. In fact, this does work except for the fact that we're using tiles. Whenever I try to pass my tiles info into the iframe it loses them.

I have this in my tiles-definition.xml:

<definition name="site.default"
<put name="header" value="/web/jsp/include/header.jsp" />
<put name="menubar" value="/web/jsp/include/menubar.jsp" />
<put name="left-nav" value="/web/jsp/include/leftNavigation.jsp" />
<put name="body-content" value="/web/jsp/homeBody.jsp" />
<put name="sessionbar" value="/web/jsp/include/sessionbar.jsp" />
<put name="footer" value="/web/jsp/include/footer.jsp" />

Where defaultFrameSet.jsp is this:

<!-- include the tiles library -->
<%@ include file="/web/jsp/include/javaIncludes.jsp" %>

<title>Test this Banner</title>
<tiles:insert name="content">
<tiles ut name="body-content"><tiles:getAsString name="body-content" /></tiles ut>
<tiles ut name="sessionbar"><tiles:getAsString name="sessionbar" /></tiles ut>
<tiles ut name="left-nav"><tiles:getAsString name="left-nav" /></tiles ut>
<tiles ut name="menubar"><tiles:getAsString name="menubar" /></tiles ut>
<tiles ut name="header"><tiles:getAsString name="header" /></tiles ut>
<tiles ut name="footer"><tiles:getAsString name="footer" /></tiles ut>
<table class="unclassified" bgcolor="red">
<iframe width='100%' height='92%' src='<html:rewrite page="/web/jsp/layout/defaultLayout.jsp" />' frameborder='no' scrolling='yes'></iframe>

Now, at this point things look real good until I actually call the defaultLayout.jsp. I have this to import the tiles attributes from the page above (if you leave the name of the attribute out its supposed to import them all according to the tiles docs):

However, this page errors out with a:
"javax.servlet.ServletException: Error - tag importAttribute : no tiles context found."

I guess the problem is that I'm somehow not getting my tiles passed into the "tile" context? I'm not exactly sure why my tiles attributes aren't being passed into the defaultLayout.jsp??

Thank you very much for your time!

"...and the Truth will set you free."
I agree. Here's the link:
subject: Passing Tiles into an IFRAME.
It's not a secret anymore!