6 Difference betwixt include directive in addition to include activity inward JSP

Difference betwixt include directive together with include action
Even though both include directive together with include activity allows yous to include response of i JSP into another, they are quite unlike from each other e.g. include directive is processed at translation time together with used to include the static resources e.g. HTML files, images together with CSS etc, piece the <jsp:include> activity is processed at request time together with used to include to a greater extent than dynamic resources e.g. JSP or Servlet. What is the departure betwixt include directive together with include activity is besides i of the most pop JSP interview questions, to a greater extent than often than non asked either at telephonic circular or offset few circular of Java spider web developer interviews? Let's run into a yoke of to a greater extent than departure betwixt these 2 to respond this inquiry inwards to a greater extent than detail. Btw, if yous are novel inwards JSP together with only learning together with preparing for interviews at the same time, so yous should besides await at Head First Servlet together with JSP, i of the best books to larn together with laid for Servlet JSP interviews together with certification at the same time.



JSP include directive vs include action

The include directive is i the iii directive supported yesteryear JSP e.g. @taglib, @include together with @page, piece the include activity is i of the many measure actions supported yesteryear JSP i.e. <jsp:include>, <jsp:forward>, <jsp:useBean>, <jsp:setProperty>, <jsp:getProperty>, <jsp:param> together with <jsp:plugin>.

Both are used to include the response of i resources  into approximately other e.g. composing JSP page amongst header portion coming shape header.jsp, footer coming from footer.jsp together with sidebar coming from sidebar.jsp. But every bit I said, they are real unlike from each other.



Here are approximately important departure betwixt include directive together with include activity inwards JSP:

1) The most cirtical departure betwixt @include together with <jsp:include> is that the include directive is processed at the translation fourth dimension but include activity i.e. <jsp:include> is processed at the asking fourth dimension i.e. when the asking comes for processing.

2) Second of import departure betwixt include directive together with include activity is thtat an include directive tin operate both relative together with absolute path but the include activity e'er uses relative path.

3) Third cardinal diference betwixt include activity together with include directive is that @include tin solely include contents of resources e.g. HTML or CSS file but it volition non procedure the dynamic resource, piece the include activity i.e. <jsp:include> procedure the dynamic resources together with consequence volition last added to calling JSP.

4) One to a greater extent than practical departure betwixt include directive together with include activity is that amongst include directive, yous tin non exceed whatever other parameter e.g request, response or whatever configuraiton, but amongst include action, nosotros tin exceed approximately other parameter besides using <jsp:param> tags.

5) Fifth departure is extension of previous departure i.e. amongst include directive, yous cannot exceed the request or response object to calling jsp to included file or JSP or vice versa, but amongst include action, it's possible to exceed request/response object.

6) Last but non the to the lowest degree departure betwixt include directive together with include activity is that one-time uses the file attribute to specify the resources to last included together with that's why know every bit file include every bit well. On the other manus include activity uses page attribute to specify the resources to last included, so besides known every bit page include inwards JSP.

Here is a overnice summary of all the differences betwixt file include together with page include i.e. include activity inwards JSP:

Difference betwixt include directive together with include activity vi Difference betwixt include directive together with include activity inwards JSP



That's all nearly the difference betwixt include directive together with include activity inwards JSP. As I said, it's i of the classical questions from Servlet together with JSP interviews together with ofttimes asked during the telephonic circular of Interview. While answering this inquiry yous should recall to get upwards the cardinal points similar include action does asking fourth dimension inclusion together with yous tin include dynamic resources similar response of approximately other JSP or Servlet using include action.

Related JSP together with Servlet Interview Questions
  • Difference betwixt Web Server together with Application Server? (answer)
  • How to upload a File inwards JSP together with Servlet? (answer)
  • Difference betwixt URL rewriting together with URL encoding inwards JSP? (answer)
  • What is JSESSIONID inwards J2EE Web Application? (answer)
  • Difference betwixt sendRedirect() together with forward() inwards Servlet? (answer)
  • Difference betwixt GET together with POST method inwards HTTP Protocol? (answer)


Further Learning
Java Web Fundamentals By Kevin Jones
Introduction to Spring MVC
Head First Servlet together with JSP

Subscribe to receive free email updates:

0 Response to "6 Difference betwixt include directive in addition to include activity inward JSP"

Posting Komentar