tag:blogger.com,1999:blog-8712770457197348465.post1594140631606136899..comments2024-03-18T23:01:42.768-07:00Comments on Javarevisited: Difference between include directive and include action in JSP Servlet? Examplejavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-8712770457197348465.post-50523970143411268002016-09-07T02:51:00.435-07:002016-09-07T02:51:00.435-07:00Can i include a servlet.class with <%@ include ...Can i include a servlet.class with <%@ include file="servlet.class" %> ?<br />With <jsp:include page="servlet.class" i can.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-13094310416501512522016-03-26T08:36:32.966-07:002016-03-26T08:36:32.966-07:00What is advantage of using one over other ?What is advantage of using one over other ?Unknownhttps://www.blogger.com/profile/05579736546118105335noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-2896476975064114162014-09-15T10:32:34.543-07:002014-09-15T10:32:34.543-07:00when I change the page that is include.. those cha...when I change the page that is include.. those changes are reflecting with include directive why so ?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-55978557625991304682013-03-30T04:20:26.929-07:002013-03-30T04:20:26.929-07:00@Diyyana Kishore Babu, another basic and important...@Diyyana Kishore Babu, another basic and important difference is that, in case of include directive the content of the include file(s) will copy to service method so there is only one service method of one Servlet class to generate. When come to Page directive, there are two Servlet classes will generate with two difference service methods. The first service method output in the form of response Kishore Diyyanahttps://www.blogger.com/profile/13825311425013751278noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-46412695105507914682012-11-17T23:34:13.153-08:002012-11-17T23:34:13.153-08:00i included a file a.jsp and changed content after ...i included a file a.jsp and changed content after running the program once.and the change reflected in both jsp include directive and jsp include action.<br />kindly specify whytejihttps://www.blogger.com/profile/06309710516884821919noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-41639582427558168402012-09-19T06:47:21.489-07:002012-09-19T06:47:21.489-07:00@Anonymous, you are correct <%!> represent d...@Anonymous, you are correct <%!> represent declaration in JSP and any variable declared using declarative tag in JSP is created as instance variable in generated Servlet. Best way to verify is look on servlet files generated by Tomcat on work directory. Thanks for pointing that out.<br /><br />@N.satish babu, Thanks for sharing those important difference between include action and include Javin @ sendredirect vs forwardhttp://javarevisited.blogspot.sg/2011/09/sendredirect-forward-jsp-servlet.htmlnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-29098396240388452382012-09-19T06:28:56.697-07:002012-09-19T06:28:56.697-07:00hi javin, there are lots of other differences betw...hi javin, there are lots of other differences between them, the value of the attribute to the jsp:include action tag can be any dynamic value i.e. request time attribute expression also, and also we can send the attributes to the including page using something like this,<br /><br /><jsp:include page="1.jsp"><br /><jsp:param name="some" value="thing"/><br N.satish babuhttps://www.blogger.com/profile/06415581973449652625noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-40632174921783090262012-09-19T06:07:37.355-07:002012-09-19T06:07:37.355-07:00hi javin as per my knowledge the line "e.g. &...hi javin as per my knowledge the line "e.g. <%!> goes into init() method of servlet" is false, as the data included in these tags will go into the body of class not into init() methodAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-74587717543940075912012-02-03T22:11:46.340-08:002012-02-03T22:11:46.340-08:00@Renu thanks for pointing it out. since include di...@Renu thanks for pointing it out. since include directive is not processed as runtime or request time its logical than any expression e.g. EL will not be evaluated.Javin @ spring interview questions answershttp://javarevisited.blogspot.com/2011/09/spring-interview-questions-answers-j2ee.htmlnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-13317964901387632332012-02-03T01:19:36.129-08:002012-02-03T01:19:36.129-08:00Another problem with jsp page include or include d...Another problem with jsp page include or include directive is that it doesn't accept expression language or any jsp expression because its not evaluated at request time. recently I have to convert include directive into include action in J2EE web application so that header and footer jsp pages which is include on request time at checks for certain attributes on request and session scope.Renunoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-9843364393089292792012-02-02T20:12:00.821-08:002012-02-02T20:12:00.821-08:00Hi, there is a flush attribute in action, Can you...Hi, there is a flush attribute in action, Can you please let us know what is this flush attribute which is mandatory and what is difference if we keep flush attribute as true or false ?Hemangnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-14177915279967291582012-02-02T07:59:42.439-08:002012-02-02T07:59:42.439-08:00Also check out my tutorial on JSP include directiv...Also check out my tutorial on <a href="http://extreme-java.com/difference-between-jsp-include-directive-and-jsp-include-action/" rel="nofollow">JSP include directive and JSP include action</a>Java Tutorialhttp://extreme-java.comnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-91123662261001102382012-01-12T21:37:34.922-08:002012-01-12T21:37:34.922-08:00Indeed page include and file include are better re...Indeed page include and file include are better reference as include action and include directive in jsp. also you should better title it as difference between Include action and include directive in JSP because you are just doing that.Anonymousnoreply@blogger.com