struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Wyatt" <>
Subject RE: [s2] Struts head tag KILLS (> 10s) page load time
Date Fri, 21 Sep 2007 01:09:06 GMT
I had the same issue... We use the ajax tabbed panel but no other dojo
widgets, but the <s:head theme="ajax"> tag had dojo "requiring" all of the
dojo widget library.

This was causing our page to fire off 70+ requests when loading. As our app
needs to be accessed up to a thousand km away, tests showed initial load
times of over 10s because of latency.

I modified web\template\ajax\head.ftl to include a custom
web\hack\ajax\dojoRequire.js that had the minimum dojo includes for the
tabbed panels. This managed to get the number of requests down to around 30,
mostly our own images and scripts, which gave acceptable load times.



<#include "/${parameters.templateDir}/${themeProperties.parent}/head.ftl" />
<script type="text/javascript"
        src="<@s.url value='/hack/ajax/dojoRequire.js' includeParams='none'
encode='false'  />"></script>
<script type="text/javascript"
        src="<@s.url value='/struts/CommonFunctions.js' includeParams='none'



dojo.hostenv.setModulePrefix('struts', 'struts');

//dojo.hostenv.writeIncludes(); // not needed, but allows the Venkman
debugger to work with the includes

Hope this helps, regards

Falun Dafa  Truth - Compassion - Forbearance

A mind & body practice under persecution in China


-----Original Message-----
From: Frank W. Zammetti [] 
Sent: Friday, 21 September 2007 8:09 AM
To: Struts Users Mailing List
Subject: Re: [s2] Struts head tag KILLS (> 10s) page load time

If Dojo is being used for AJAX in this case, that's my guess.  I know from
experience that Dojo, can issue a TON of requests even if you think your
only loading a small portion of it.  Assuming this guess is correct,
Musachy, does S2 use a custom build of Dojo?  If not, that might be worth


Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
AIM/Yahoo: fzammetti
Author of "Practical Ajax Projects With Java Technology"
  (2006, Apress, ISBN 1-59059-695-1)
and "JavaScript, DOM Scripting and Ajax Projects"
  (2007, Apress, ISBN 1-59059-816-4)
Java Web Parts -
  Supplying the wheel, so you don't have to reinvent it!

chengas123 wrote:
> Hi,
> I am working on a Struts 2 page and page load times are way too high.  
> I tracked it down to the Struts head tag, which I have as follows: 
> <s:head theme="ajax" /> Without the tag, my page issues 3 requests and 
> takes 453ms to load.  With the tag, the page issues 54 requests taking 
> 12.24s to load.
> Is there something I am doing wrong here?
> Thanks,
> Ben

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message