aspose file tools*
The moose likes Struts and the fly likes absolute & relative file addressing in Tiles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "absolute & relative file addressing in Tiles" Watch "absolute & relative file addressing in Tiles" New topic
Author

absolute & relative file addressing in Tiles

Chris Pat
Ranch Hand

Joined: Aug 27, 2005
Posts: 156
Hello
I am learing tiles and am unclear on the issue of file locations. Lets say I
have my layouts00.jsp under layouts under web-inf
WEB-INF:Layouts:layouts00.jsp
and I have
WEB-INF:Style00:header00.jsp|body00.jsp|footer.jsp

My questions are on the tiles-definition spec and where is the resultant html
generated.
1. would a line in the definition be like this:
<put name="header" value="/Style00/header00.jsp" />
iow, from the tiles-definition can I just relatively address the files that I
am subsituting for this definiton?
2. What is the final location of the rendered html? I have customer jscript
functions that need to be loaded and custom css that need to be relatively
addressed from resultant html. Do I put those in WEB-INF:Style00:
JspCssStuff? Sorry for the unsophistication of this question, its a
beginning.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61229
    
  66

Moved to the Struts forum.,


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Chris Pat
Ranch Hand

Joined: Aug 27, 2005
Posts: 156
Originally posted by Bear Bibeault:
Moved to the Struts forum.,


Hello
Also is it possible to load jscript and css with tiles such that they work? I assume I need to do something with flush. Possibly dont flush until the page is rendered but not presented then somehow flush to browser and let it automagically find and activate the jscript and css? What is the proper way for this type of synthetic complex page generation? tia.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I am not an expert in this area, but I might be able to help out. Since the browser loads the css and js files separately, then need to be in a directory that is accessible by the outside world. Files under your WEB-INF directory cannot be accessed, so you cannot put your css and js files there.

Do you really need to access files relatively? My memory tells me that relative paths need to be from the location of the base tile file. I am not sure where the html:base tag fits into this. As I recall we had the html:base tag in our default layout jsp but that caused us problems in production which uses https and an accelerator.

Here are a couple lines of code to load css and js files using absolute paths using the html:rewrite tag:

<link rel="stylesheet" type="text/css" href="<html:rewrite page='/css/style.css'/>" />
<script language="javascript1.2" type="text/javascript" src="<html:rewrite page='/js/common.js'/>"></script>

- Brent
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: absolute & relative file addressing in Tiles