Author Topic: What’s the Difference between Static Include and Dynamic Include in JSP?  (Read 1868 times)

0 Members and 1 Guest are viewing this topic.

comagainwithfresh

  • Guest
Last day I was taking an interview in my company. The interview was for WebSphere Commerce. So I thought of going directly to WCS questions. But that guy said that he was working on WCS long back and he forgot everything in WebSphere Commerce. Then I thought I will ask some JSP questions as he was mentioned JSP in each and every project in his resume.

I thought of starting with a usual JSP interview question. So I asked him what is the difference between static include and dynamic include in JSP. His answer was partially correct. So I though I will write a post on what are the differences between static include and dynamic include in JSP. So the difference between static include and dynamic include are:

1) The syntax for static include is <%@ include file=”filename.jsp” %> and the syntax for dynamic include is <jsp:include page=”filename.jsp” />
2) Static include is an inline inclusion. i.e., the contents of the file will be included at translation phase. It’s something like a copy and paste. In case of dynamic include the response of the file will be included to the original response at runtime. The file will be processed separately and only the response will become the part of the original files’ response.
3) Static include cannot have a dynamic filename. This is because the servlet container needs the files for inclusion, at translation phase itself. But dynamic include can have a dynamic filename. Here the file is getting included at runtime.
4) Static include cannot accept a parameter (What this parameter will do even if are passing it?). But dynamic include can accept a parameter. (Here we have some one to do something on the parameter).
5) Static includes are faster than dynamic includes.


1,000 Leads Daily - 3 Day Risk Free Trial

Business Opportunity Leads!


 

P.S. Do you want to see how we made $14,178.00 Dollars Last Month?

Click Here For All The Info!

Free Advertising Forum Post Ads Online