Sunday, November 24, 2019

6 Divergence Betwixt Include Directive Too Include Activeness Inwards Jsp

Difference betwixt include directive too include action
Even though both include directive too include activeness allows y'all to include response of 1 JSP into another, they are quite dissimilar from each other e.g. include directive is processed at translation time too used to include the static resources e.g. HTML files, images too CSS etc, spell the <jsp:include> activeness is processed at request time too used to include to a greater extent than dynamic resources e.g. JSP or Servlet. What is the deviation betwixt include directive too include activeness is too 1 of the close pop JSP interview questions, generally asked either at telephonic circular or origin few circular of Java spider web developer interviews? Let's run across a duet of to a greater extent than deviation betwixt these ii to respond this interrogation inwards to a greater extent than detail. Btw, if y'all are novel inwards JSP too merely learning too preparing for interviews at the same time, too then y'all should too await at Head First Servlet too JSP, 1 of the best books to larn too arrive at for Servlet JSP interviews too certification at the same time.



JSP include directive vs include action

The include directive is 1 the 3 directive supported past times JSP e.g. @taglib, @include too @page, spell the include activeness is 1 of the many criterion actions supported past times JSP i.e. <jsp:include>, <jsp:forward>, <jsp:useBean>, <jsp:setProperty>, <jsp:getProperty>, <jsp:param> too <jsp:plugin>.

Both are used to include the response of 1 resources  into merely about other e.g. composing JSP page alongside header component subdivision coming shape header.jsp, footer coming from footer.jsp too sidebar coming from sidebar.jsp. But every bit I said, they are rattling dissimilar from each other.




Here are merely about important deviation betwixt include directive too include activeness inwards JSP:

1) The close cirtical deviation betwixt @include too <jsp:include> is that the include directive is processed at the translation fourth dimension but include activeness i.e. <jsp:include> is processed at the asking fourth dimension i.e. when the asking comes for processing.

2) Second of import deviation betwixt include directive too include activeness is thtat an include directive tin purpose both relative too absolute path but the include activeness ever uses relative path.

3) Third key diference betwixt include activeness too include directive is that @include tin exclusively include contents of resources e.g. HTML or CSS file but it volition non procedure the dynamic resource, spell the include activeness i.e. <jsp:include> procedure the dynamic resources too upshot volition move added to calling JSP.

4) One to a greater extent than practical deviation betwixt include directive too include activeness is that alongside include directive, y'all tin non overstep whatever other parameter e.g request, response or whatever configuraiton, but alongside include action, nosotros tin overstep merely about other parameter too using <jsp:param> tags.

5) Fifth deviation is extension of previous deviation i.e. alongside include directive, y'all cannot overstep the request or response object to calling jsp to included file or JSP or vice versa, but alongside include action, it's possible to overstep request/response object.

6) Last but non the to the lowest degree deviation betwixt include directive too include activeness is that onetime uses the file attribute to specify the resources to move included too that's why know every bit file include every bit well. On the other manus include activeness uses page attribute to specify the resources to move included, thence too known every bit page include inwards JSP.

Here is a overnice summary of all the differences betwixt file include too page include i.e. include activeness inwards JSP:

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

  • Further Learning
    Java Web Fundamentals By Kevin Jones
    Spring Framework 5: Beginner to Guru
    JSP, Servlets too JDBC for Beginners: Build a Database App


    No comments:

    Post a Comment