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 )

Interview Question: What is the difference between Message Driven Beans and Stateless Session beans?

Interview Question: What is Deployment descriptor?

Question: What is an output comment in JSP?

Question: Explain the life-cycle methods in JSP?

Question: What is the directory structure of a web application?

What are the services provided by a J2EE container?

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

What is difference between Java Bean and Enterprise Java Bean?

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

Explain the Polymorphism principle.

Interview Question: Is Struts compatible with other Java technologies?

Interview Question: What is Action Class?

What types of comments are available in the JSP?

What is the difference between Session Bean and Entity Bean?

What do you understand by a J2EE module?

Latest Articles (in Interview)