Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

multiple JS files with Struts Tiles  RSS feed

Quince bise
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can't use the same name to the two parameter... try to change the second parameter to something like this:

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!