You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Shaw <he...@gmail.com> on 2005/10/06 11:55:37 UTC

Using Tiles to handle multiple javascript files

I'm using tiles for page layout, my tiles-definitions looks something like this:

<tiles-definitions>
	<definition name=".layout" path="/WEB-INF/layouts/standard.jsp">
		<put name="footer" value="/WEB-INF/footer.jsp"/>
	</definition>
	
	<definition name=".homeLayout" extends=".layout">
		<put name="header" value="/jsp/document/Header.jsp" />
	</definition>
...

At the moment, we have <script> tags used in many JSPs, often not
within a <head> section (I didn't write this code ;-).  My aim is to
get all the javascript files required for the whole page, and include
them in one go, like this:

*** standard.jsp ***

<html>
<head>
<script src="/all-javascript.jsp?modules=common,documents,links"/>
<!-- modules list needs to be dynamically generated by tiles -->
</head>
...

The file 'all-javascript.jsp' maps the names like "common",
"documents" to actual javascript files and sends them in a single
request.

Do you have any ideas how I might generate this module list?  One idea
I had was to use <putList> inside the definitions, but I haven't
managed to get any satisfactory results as yet.

Thanks in advance
James Shaw

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