aspose file tools*
The moose likes Struts and the fly likes Problem using html frames with struts and tiles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem using html frames with struts and tiles" Watch "Problem using html frames with struts and tiles" New topic
Author

Problem using html frames with struts and tiles

James Blackmore
Greenhorn

Joined: Apr 11, 2005
Posts: 5
Hi

I have an application using Struts and Tiles and the body of the index page JSP looks something like this:

<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td colspan="2"><tiles:insert attribute="header"/></td>
</tr>
<tr>
<td>
<table cellspacing="0" cellpadding="5" border="0" width="100%">
<tr>
<td valign="top" width="200">
<tiles:insert attribute="menu" />
</td>
<td valign="top">
<tiles:insert attribute="body"/>
</td>
</tr>
</table>
</td>
</tr>
</table>

This works fine but I have a requirement to convert this page to use frames so (from reading other posts on this forum) I now have the following:

<frameset rows="80,*" cols="*" frameborder="NO" border="0" framespacing="0">
<frame src="<tiles:getAsString name='header'/>" name="header" >
<frameset rows="*" cols="194,*" framespacing="0" frameborder="NO" >
<frame src="<tiles:getAsString name='menu'/>" name="menu" >
<frame src="<tiles:getAsString name='body'/>" name="main" >
</frameset>
</frameset>

Unfortunatly this does not work (each frame ends up containing my standard error page). I've been through all the posts relating to this type of problem that I can find on this forum and have tried many variations of this code but with no success. I'd be grateful for any help anyone can offer.

Many thanks

James
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

A requirement to use frames? Can't a solution be found without them?


A good workman is known by his tools.
James Blackmore
Greenhorn

Joined: Apr 11, 2005
Posts: 5
Thanks for the reply Marc. It doesn't have to be frames but I don't know what else I can use to achieve the functionality I'm after. I need to hold the menu (which uses struts-menu btw) in place while the body content scrolls. I've tried the Javascript watermark script but its not ideal (i.e. the client doesn't like it). Tried an iFrame for the content but get the same problem as with normal frames. I'd certainly welcome any other suggestions, but from what I've read here my code (or something similar) should work.

Thanks again
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

<frameset rows="80,*" cols="*" frameborder="NO" border="0" framespacing="0">
<frame src="<tiles:getAsString name='header'/>" name="header" >
<frameset rows="*" cols="194,*" framespacing="0" frameborder="NO" >
<frame src="<tiles:getAsString name='menu'/>" name="menu" >
<frame src="<tiles:getAsString name='body'/>" name="main" >
</frameset>
</frameset>

Is the second </frameset> necessary?

You did not mention what the getAsString tags are returning. Are they the names of jsps? I don't think any other value would make sense in this context.
James Blackmore
Greenhorn

Joined: Apr 11, 2005
Posts: 5
The header frame needs to go right across the top of the page, with the menu frame underneath and down the left with the content on the right, so I think so. The layout look right on the page.

Yes the 'getAsString' calls are to JSPs. I've viewed the source of the generated page and its finding the correct JSPs. I also tried 'get' calls instead and the source of the JSPs was written into the generated HTML, but this still didn't work.

Could it be something to do with the way Struts is configured? Do I need to set up action forwards for the pages? I can't access the JSPs if I type their URL into the browser address bar (e.g. http://host ort/appContext/x.jsp). Sorry, I'm new to Struts and am modifying code that I didn't originally write.
James Blackmore
Greenhorn

Joined: Apr 11, 2005
Posts: 5
Sorry, unintentional smiley there!
James Blackmore
Greenhorn

Joined: Apr 11, 2005
Posts: 5
Sorry, unintentional smiley there!
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Originally posted by James Blackmore:
Could it be something to do with the way Struts is configured? Do I need to set up action forwards for the pages? I can't access the JSPs if I type their URL into the browser address bar (e.g. http://host ort/appContext/x.jsp). Sorry, I'm new to Struts and am modifying code that I didn't originally write.


If the jsps are in the WEB-INF folder you will not be able to access them directly from the browser and will need some Struts Actions that point to them.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem using html frames with struts and tiles