942,514 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Marked Solved
  • Views: 79147
  • JSP RSS
Jan 22nd, 2008
-1

Difference between <%@include%> and <jsp:include>

Expand Post »
Hi friends
Can anyone tell me about the difference between <%@include file="abc.jsp" %> and <jsp:include file="abc.jsp"/>
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
sree22_happy is offline Offline
39 posts
since Mar 2006
Jan 27th, 2008
1

Re: Difference between <%@include%> and <jsp:include>

Think of the include directive as a header file of languages like C/C++. When using the include directive, the combined contents of the original JSP page and all its included resources are translated into the same implementation servlet i.e. the contents of the included resource is copy pasted before translation to a servlet. The important thing here is that all this happens during translation time and only static content is supported.

The include action <jsp:include> is almost similar to the include directive except for a few subtle differences. The include action is executed at request time as opposed to translation time. Thus instead of the content of the include file being included in the calling JSP, the output of the JSP is included or passed to the JSPWriter of the calling page. This allows us to include both static and dynamic content into the JSP page. Using the jsp action also allows you to explicitly pass parameters to the included page.
JSP Syntax (Toggle Plain Text)
  1. <jsp:include page="/index.jsp">
  2. <jsp:param name="name" value="sos" />
  3. </jsp:include>
Super Moderator
Featured Poster
Reputation Points: 3209
Solved Threads: 718
Failure as a human
~s.o.s~ is offline Offline
8,867 posts
since Jun 2006
Jan 30th, 2008
0

Re: Difference between <%@include%> and <jsp:include>

thanks for the answer !
Reputation Points: 10
Solved Threads: 1
Light Poster
sree22_happy is offline Offline
39 posts
since Mar 2006
Jun 22nd, 2011
0
Re: Difference between <%@include%> and <jsp:include>
Can we include htmls via <%@include%>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
haribol is offline Offline
1 posts
since Jun 2011

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: file upload using multipart
Next Thread in JSP Forum Timeline: thread in jap





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC