Home Help Java I Include directive vs Include Action



Include directive vs Include Action
Posted on: November 11, 2009 at 12:00 AM
Include directive (<%@ include %>) includes file into the JSP page at compile time.

Include directive vs Include Action

     

Include directive: Include directive (<%@ include %>) includes file into the JSP page at compile time. Include directive should be used if the included code is in the same page.

Include Action: Includes action (<jsp:include>) includes the output at runtime. Include action (runtime include) runs a bit slower yet it is preferred generally because it save a lot of memory of the system. 

E.g: Suppose there are two pages welcome.jsp and index.jsp and welcome.jsp includes index.jsp, index.jsp is invoked only when welcome.jsp executes, and the output of index.jsp is inserted into the output stream of welcome.jsp. 

For example, if you want to use an include having a set of tag libraries with the taglib directive, you should use a compile-time include. If you wish to insert a standard header and footer in your page, include action will be more efficient.

Related Tags for Include directive vs Include Action:


More Tutorials from this section

Ask Questions?    Discuss: Include directive vs Include Action  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.