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

multiple JS files with Struts Tiles

Quince bise

Joined: Jan 22, 2008
Posts: 8
Hi anybody please help...
I am using struts - tiles with my application. currently when using only one js file has no problem. but when i add new js file same method as what i did on my first js file, it cannot read the function from the second js file. Bold Font is my 2nd(added) js file, i placed it above the first.

On my Tiles-Defs.xml
<definition name="defaultLayout" path="/layout/defaultTemplate.jsp">
<put name="jsfile" value="/js/Prototype.js"/>
<put name="jsfile" value="/js/functions.js"/>
<put name="header" value="/layout/header.jsp"/>
<put name="body" value="/layout/body.jsp"/>
<put name="menuBar" value="/layout/menuBar.jsp"/>
<put name="footer" content="/layout/footer.jsp" />

My defaultTemplate.jsp is

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<link rel="stylesheet"
href="<html:rewrite page='/css/style.css' />" type="text/css">
<script src="<%=request.getContextPath()%><tiles:getAsString name='jsprototype' ignore="true"/>"></script>
<script src="<%=request.getContextPath()%><tiles:getAsString name='jsfile' ignore="true"/>"></script>
<tiles:insert attribute="title" ignore="true" />

<tiles:insert attribute="header" ignore="true"/>
<tiles:insert attribute="menuBar" ignore="true"/>
<tiles:insert attribute="environmentMenu" ignore="true" />
<%-- include body --%>
<tiles:insert attribute="body" ignore="true" />
<%-- include footer --%>
<tiles:insert attribute="footer" ignore="true"/>

Thank you.
Robert Siqueira
Ranch Hand

Joined: Jan 21, 2008
Posts: 38
you can't use the same name to the two parameter... try to change the second parameter to something like this:

I agree. Here's the link:
subject: multiple JS files with Struts Tiles
It's not a secret anymore!