Programming Tutorials

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

By: Karthik in Interview Tutorials on 2012-06-16  

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.






Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in Interview )

Question: What is a Hidden Comment in JSP?

What types of comments are available in the JSP?

Tell me something about J2EE component?

The output of System.out.println(5<<2) in Java

What is Collection API?

Name the containers which uses Border Layout as their default layout?

Interview Question: Do ActionForms have to be true JavaBeans?

What is the difference between Session Bean and Entity Bean?

Why J2EE is suitable for the development of distributed multi-tiered enterprise applications?

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

Interview Question: What is Action Class?

Interview Question: What is re-entrant. Is session beans reentrant. Is entity beans reentrant?

The output of System.out.println(5>>2) in Java

What do you understand by JTA and JTS?

Interview Question: What is the difference between EAR, JAR and WAR file?

Latest Articles (in Interview)