| | |
Difference between <%@include%> and <jsp:include>
Thread Solved |
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.
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)
<jsp:include page="/index.jsp"> <jsp:param name="name" value="sos" /> </jsp:include>
I don't accept change; I don't deserve to live.
Sacrifice is a painful, pure and beautiful thing.
Sacrifice is a painful, pure and beautiful thing.
![]() |
Similar Threads
- Help for learnign JSP (JSP)
- Opinions? javascript/php/etc and programming standards (JavaScript / DHTML / AJAX)
- Programming FAQ - Updated 1/March/2005 (Computer Science)
Other Threads in the JSP Forum
- Previous Thread: Want a Dummy JSP project for study
- Next Thread: How to create Charts and Diagrams in JSP/Servlet
Views: 24217 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for JSP
action apache array backbutton books boonex combobox comma connection csv database debugging development directorystructure dropdownlist dynamicpagetitles eclipse examples excel form forward frames generating glassfish ie8 image2database imagestoring imagetodatabase imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mime-rfc multiple mvc2 mvcmodel2 mysql netbeans network non-standard-mime objects open parameters passing ping printinserverinsteadofclient project quickguide read redirect request.getparameter resorces response resultset seperated servlet servletdopost()readxml sessions social software source sql ssl standard-mime state_saving_method stocks sun tomcat tutorial unique update values video web write






