How to Use JSP include Tag in Dynamic File Processing

JSP include tag with Dynamic Files Processing
The
<jsp:include>
tag allows you to include either a static or dynamic file. A static file is parsed and its content included in the calling JSP page. A dynamic file acts on the request and sends back a result that is included in the JSP page. You cannot always determine from a pathname if a file is static or dynamic. For example, a pathname like
http://server:8080/index.html
might map to a dynamic servlet by using a Web server alias. The
<jsp:include>
tag handles both types of files, so it is convenient to use when you donít know whether the file is static or dynamic. When the include action is finished, the JSP engine continues processing the remainder of the JSP file.

JSP Syntax
<jsp:include page="{ relativeURL | <%= expression %>}" flush="true" />


Examples




Attributes
1. page="{ relativeURL | <%= expression %>}"
The relative URL to the file to be included, or an expression that evaluates to a String equivalent to the relative URL. The relative URL looks like a pathname; it cannot contain a protocol name, port number, or domain name. The URL can be absolute or relative to the current JSP file. If it is absolute beginning with a /, the pathname is resolved by your Web or Application server.
2. flush="true"
In JSP 1.0, you must include flush="true", as it is not a default value


Related Topic JSP Interview Questions & Answers
JSP Variable Declaration Statement
How to Add Text File or Code in a JSP File at Translation Time
JSP Page Directive for Translation Unit
Factors to be considered for Developing Application Software for Mobile Devices

nScraps.com © 2011   Privacy Policy  Terms of Service  Feedback