> -----Original Message----- > From: Brian McSweeney [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 02, 2003 11:01 AM > To: 'Struts Users Mailing List' > Subject: RE: Question about minimizing javascript loaded into web page > > > > > > Helps very much Saul. Cheers. > > Final dumb question: > > So is the result of this that only the javascript methods pertaining to > each jsp gets loaded into the page?
Yes for the dynamic part. The static part will be an external reference through the <script src=... tag, I think it will be cached by the browser, so it won't be loaded every time. Anybody please correct me if this is not the case. > > If so, do you know why this isn't the default behaviour? The default is staticJavascript=true, as defined in the tag source. Saul > > Thanks, > Brian > > > -----Original Message----- > From: Yuan, Saul (TOR-ML) [mailto:[EMAIL PROTECTED] > Sent: 02 October 2003 13:46 > To: Struts Users Mailing List > Subject: RE: Question about minimizing javascript loaded into web page > > > > > Hi Saul, > > Could you explain this a little more. I'm interested too. > > > > For example, at the moment I'm just using the tag: > > > > <html:javascript formName="myForm" /> > > > > This brings down all the validator javascript in the page. > > > > 1) Is this what you mean by "static javascript"? > > yes > > > > > > 2) What exactly would you put in the staticJavascript.jsp page? > > Pulled from the struts example application, basically it's setting > dynamicJavascript="false" staticJavascript="true" > > staticJavascript.jsp: > --------------------------------------------- > > <%@ page language="java" %> > <%-- set document type to Javascript (addresses a bug in Netscape > according to a web resource --%> > <%@ page contentType="application/x-javascript" %> > > <%@ taglib uri="/WEB-INF/lib/struts-html.tld" prefix="html" %> > > <html:javascript dynamicJavascript="false" staticJavascript="true"/> > > --------------------------------------------- > > > > 3) What's the difference between static and dynamic javascript? > > (Probably a > > real dumb question :-) ) > > dynamic javascripts are generated based on the particular fields of your > jsp page, say, the validation error messages etc. The static javascripts > are those validation javascript functions as defined in the > validator-roles.xml file. > > > Hope this helps. > > Saul > > > > > > Am a bit confused :-) > > Thanks, > > Brian > > > > > > -----Original Message----- > > From: Yuan, Saul (TOR-ML) [mailto:[EMAIL PROTECTED] > > Sent: 01 October 2003 21:09 > > To: Struts Users Mailing List > > Subject: RE: Question about minimizing javascript loaded into web page > > > > If you don't want static javascript rendered inside your jsp page, you > > can set: > > > > staticJavascript="false" and have <script src="staticJavascript" ... > > reference the static part. > > > > Something like below: > > > > <html:javascript formName="yourForm" method="validateYourForm" > > dynamicJavascript="true" staticJavascript="false" /> > > > > <script language="Javascript1.1" src="staticJavascript.jsp"></script> > > > > > > Saul > > > > > > > > > > I apologize if this is a question that has already been addressed, > but > > > I've > > > not been able to find an answer... > > > > > > We have implemented the validation framework into our webapp and it > > works > > > well. We have noticed that all of the validation javascript is > loaded > > > into > > > the web page, even if the validation is not applied on the page. > The > > > loaded javascript can be over half of the loaded page's content. > > > > > > I think my javascript tag (struts-html:javascript) looks right. The > > > dynamic javascript is built as expected, but the static javascript > > just > > > brings in everything. Has anybody sen this before? > > > > > > I appreciate any guidance. > > > Nick > > > > > > > > > > > > > --------------------------------------------------------------------- > > > 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] > > > > > > --------------------------------------------------------------------- > > 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] > > > --------------------------------------------------------------------- > 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]