What is the difference in functionality and which gives a higher performance between this two (i.e. including a JSP containing HTML code and JavaScript functions and including an html page containing HTML code and JavaScript functions) ;
If I were to do it...I would test it by including it about a hundred times (seperately) in a JSP. For this test JSP, first print the time, then add the hundred includes, then print the time. Unfortunately, includeing HTML fails in the Tomcat 4.0*. We had a discussion on this issue in the SCWCD forum. I haven't tried it since. regds. - madhav
It would seem to me Gabriel that the include for the jsp has to be more expensive as the jsp needs to be compiled into a servlet and then after that needs to be included while as the html can be included as a static text file...... I hope that makes sense..... Sahil
Hi Madhav , i will try playing around with your logic . Besides,it's nice knowing that including an html page does not work with Tomcat 4.0 . I am interested in this since it worked im Tomcat 3.2.1 which i'm using locally,but the application will be deployed on Tomcat 4.0. Sandy, U are very right. I tried organising my JSPs by factoring out all JavaScript functions in a XXXX.js file and include in any desired page using <Script src='asd.js'></Script> but this did not work. Well , if we can discuss this further all ideas are welcomed. Madhav , how do i get to the discussion on including html in JSP and Tomcat 4.0.
The performance hit of doing the include is only incurred once though, for either of those.
Yes, the included jsp would need to be compiled, and then included, whereas the HTML would merely be included. But for both of the files, this only happens once.
If you were to use the <%@ include page="foo.*" %> syntax, then this would be included every time the page is called, and is thus more performance intensive. Additionaly, the jsp is recompiled each time it's included. So using <%@ would make any performance hit attributable to the jsp much more obvious.
Gabriel, I'll address something you made in your last post:
Try putting all your javascript in a single .js file and using the static include. (this one: <%@ ). I do this for css style sheets, and it works fine.
I'm not sure why people had trouble with including html files in Tomcat 4.x It works for me.
If you go into Tomcat's example directory: webapps/example/jsp/include/include.jsp
and add the following to the bottom of the file:
You will see that both <%@ and <jsp:include works for both JSP and HTML content.
Hi Mike, i just want to clarify this by : <Script src='asd.js'></Script> , by asd.js i was refering to a java-script file though that was a digression. But, do U reckon that instead of trying : <Script src='asd.js'></Script> that i can as well use : <%@ file="includedJavaScriptFunctionsPage.jsp" %> By the second i mean sticking all my Javascript functions in a JSP and including when needed. Cheers Mike, i have printed the link resource U gave.