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.

Eg.

web\template\ajax\head.ftl:

<#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'
encode='false'/>"></script>


web\hack\ajax\dojoRequire.js:

dojo.require("dojo.io.BrowserIO");
dojo.require("dojo.event.topic");

dojo.hostenv.setModulePrefix('struts', 'struts');
//dojo.require('dojo.widget.*');
dojo.widget.manager.registerWidgetPackage('struts.widget');

dojo.require("struts.widget.Bind");
dojo.require("struts.widget.BindDiv");
//dojo.require("struts.widget.BindAnchor");
//dojo.require("struts.widget.ComboBox");
//dojo.require("struts.widget.StrutsTimePicker")
//dojo.require("dojo.widget.Editor2");
//dojo.hostenv.writeIncludes(); // not needed, but allows the Venkman
debugger to work with the includes


Hope this helps, regards
Jason

-----
Falun Dafa  Truth - Compassion - Forbearance

A mind & body practice under persecution in China

http://www.faluninfo.net



 

-----Original Message-----
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] 
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
considering.

Frank

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
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 - http://javawebparts.sourceforge.net
  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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to