What is the differene between include directive and include action?

Showing Answers 1 - 5 of 5 Answers

siva kumar reddy

  • Aug 1st, 2006
 

include directive:

<% @ page include="header.jsp" %>

this is content

<% @ page include="footer.jsp" %>

in this case first merge three files then jsp comiler create only one  servlet.whenever send the request by client the wedcontainer execute that file only.this also called as satatic include.it will takes less time.

include tag:

<jsp:include page="/header.jsp" />

this content

<jsp:include page="/footer.jsp"/>

in this case jsp compiler generates the javacode for three servlets.whenever send the request by server ,the webcontainer executs three servlets and send the response.this is also called as dynamic include.it will takes more time.

  Was this answer useful?  Yes

An include directive tells the jsp engine  to include contents of another file (HTML,JSP,etc) in the current page.More specific, In this case included file's code is included in current  page. Its called static inclusion.

In case of include action included file's code is not included in current page control temporary transfer to the included file and return back to the main page when included file finishes execution. It's dynamic inclusion,when the jsp is requested, it sends request to another object the output of the object is included in the requested jsp page.we use <jsp:include> for dynamic inclusion.

  Was this answer useful?  Yes

ramana

  • Aug 30th, 2006
 

include directive:<%@ include file="x.jsp"%>

    whenever we use include directive the contents of the specified jsp will be included at translated time (translate means jsp to servlet)

include action::<jsp:include page="x.jsp"/>

    whenever we use include action the response of the specified jsp will be included at run time. internally it uses jspRuntimeLibrary class and uses include method in this class. the paramaters of this include method are request,response, x.jsp, out, false.

  Was this answer useful?  Yes

include directive:<%@ include file="x.jsp"%>

this is static, means x.jsp combined to with in that jsp when traslating to servlet.

include action::<jsp:include page="x.jsp"/>

we can call this dynamically and included at request processing time.

  Was this answer useful?  Yes

sweetha

  • Oct 5th, 2006
 

your answer is absolutely correct.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions