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 )

What are the call back methods in Session bean?

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

Interview Question: Why it is called Struts?

What is transient variable?

Interview Question: Can i map more than one table in a CMP?

Interview Question: Do ActionForms have to be true JavaBeans?

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

Interview Question: What is EJB container?

Interview Question: What is the difference between sessioncontext and entitycontext?

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

Interview Question: What is lazy loading?

Interview Question: What are the call back methods in Entity bean?

What are the services provided by a J2EE container?

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

What do you understand by Synchronization?

Latest Articles (in Interview)