Does anybody could explain me the use of pageContext.include(String relativeUrlPath);?

Daniel Zen

There are three (main) ways to include a file in a JSP:

1. <% pageContext.include(String relativeUrlPath); %>
2. <jsp:include page="relative URL" flush="true" />
3. <%@ include file="relative url" %>

The first (#1) allows you to specify a variable url in your JSP. relativeUrlPath can be calculated. The last two only allow you to include a literal (hardcoded) String as the URL.

The last one (#3) lets you include files at the time the JSP page is translated into a servlet. They actually become part of the generated servlet code. Changing the file that is included won't have an effect until the jsp is modified and recompiled. Whereas the first two include the file at execution time so modifications to the included file will be noticed the next time the page is executed.
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact