R4R
Right Place For Right Person TM

What is the difference between <%@ include ...> (directive include) and <jsp:include> ?

previous previous previous
Question:
What is the difference between <%@ include ...> (directive include) and <jsp:include> ?

Question:What is the difference between <%@ include ...> (directive include) and <jsp:include> ?


Answer
The include directive :- <%@ include file="fileName" %> is static and processed at the time when the JSP page is translated into its equivalent servlet. The file included in the page at the time translation and compiled file also contain the included file code. This directive is normally used for including static resources only - like, banner, header, footer, etc. If you make some changes in the included file then it will not affect those files which had included this file. The include action :- <jsp:include page="relativeURL" /> is dynamic and processed at runtime. This will simply make a function call at run time to the included file. This action allows additional parameters to be passed via <jsp:param> child element of this include action element. If you make some changes in the included file then it will also affect those files which had included this file.

By:Jalees
Date:

What is the difference between <%@ include ...> (directive include) and <jsp:include> ?

Post Your Answers


User Name:
Answers:

Related Links

  1. Can I just abort processing a JSP?
  2. What are the parameters for service method ?
  3. How do I prevent the output of my JSP or Servlet pages from being cached by the browser?
  4. How to refer the "this" variable within a JSP page?
  5. Can we implement an interface in JSP ?
  6. How do I use a scriptlet to initialize a newly instantiated bean?
  7. What are JSP Actions?
  8. What is the difference between ServletContext and ServletConfig?
  9. What is a Hidden Comment?
  10. How to pass information from JSP to included JSP?
  11. How do you pass data (including JavaBeans) to a JSP from a servlet?
  12. How can I set a cookie?
  13. How will you delete a cookie?
  14. What JSP lifecycle methods we can override?
  15. How will you include a static file in a JSP page?
  16. How you can perform browser redirection?
  17. Can we use ServletOutputStream object from a JSP page?
  18. How can I invoke a JSP error page from a servlet?
  19. How can I enable session tracking for JSP pages if the browser has disabled cookies?
  20. How can you declare methods in your JSP page?
  21. How can we set the inactivity period on a per-session basis?
  22. How do you pass an init parameter to a JSP?
  23. How can my application get to know when a HttpSession is removed?
  24. How many cookies can one set in the response object of the servlet? Also, are there any restrictions on the size of cookies?
  25. When a session object gets added or removed to the session, which event will get notified ?
  26. What is URL Encoding and URL Decoding ?
  27. What is the difference between an applet and a servlet?
  28. What are the different web servers available name few of them?
  29. What are the different types of ServletEngines?
  30. What is a Session Id?
  31. What is the use of setComment and getComment methods in Cookies ?
  32. Why we are used setMaxAge() and getMaxAge() in Cookies ?
  33. What is the use of setSecure() and getSecure() in Cookies ?
  34. Is HTML page a web component?
  35. What is the container?
  36. What is deployment descriptor?
  37. How can I print the stack trace of an exception from a JSP page?
  38. Do objects stored in a HTTP Session need to be serializable? Or can it store any object?
  39. What is the differecnce between JspWriter and PrintWriter?
  40. How can you implement singleton pattern in servlets ?
  41. What is the difference between an application server and a web server?
  42. Can we implement Runnable interface from within our servlet?
  43. What is RequestPocessor class? How will you create your own RequestPocessor?
  44. Can you test a JSP page using Junit?

Question:What is the difference between <%@ include ...> (directive include) and <jsp:include> ?

Back Home Next

New Updates

Topics

Topics

R4R
R4R
R4R
R4R
R4R
R4R
R4R
R4R