What is the difference between jsp:include page and @ include file?

By: Karthik  

Question: What is the difference between <jsp:include page = ... > and 
<%@ include file = ... >?.
Answer: Both the tag includes the information from one page in another. The differences are as follows:
<jsp:include page = ... >: This is like a function call from one jsp to another jsp. It is executed ( the included page is executed  and the generated html content is included in the content of calling jsp) each time the client page is accessed by the client. This approach is useful to for modularizing the web application. If the included file changed then the new content will be included in the output.
<%@ include file = ... >: In this case the content of the included file is textually embedded in the page that have <%@ include file=".."> directive. In this case in the included file changes, the changed content will not included in the output. This approach is used when the code from one jsp file required to include in multiple jsp files.

Most Viewed Articles (in Interview )

How to define an Abstract class?

What are implicit Objects available to the JSP Page?

Interview Question: Why aren't the Struts tags maintained as part of the Jakarta Taglibs project ?

Interview Question: What is ActionServlet?

Interview Question: If the framework doesn't do what I want, can I request that a feature be added?

Interview Question: What about JSTL and JavaServer Faces ?

Interview Question: Is there a particularly good IDE to use with Struts ?

Interview Question: Why are some of the class and element names counter-intuitive?

What is similarities/difference between an Abstract class and Interface?

Explain the new Features of JDBC 2.0 Core API?

What is difference between Java Bean and Enterprise Java Bean?

What do you understand by JSP Actions?

Interview Question: Do ActionForms have to be true JavaBeans?

What do you understand by a container?

Interview Question: Where can I get help with Struts?

Latest Articles (in Interview)

Comment on this tutorial