jsp:include | |
This action allows a static or dynamic resource to be included in the current JSP at request time. The resource is specified using the URL format described in the earlier section on the include directive. An included page has access only to the JspWriter object, and it cannot set headers or Cookies. A request-time exception will be thrown if this is attempted. The constraint is equivalent to the one imposed on the include() method of the javax.servlet.RequestDispatcher class. If the page output is buffered then the buffer is flushed prior to the inclusion. The jsp:include action pays a small penalty in efficiency, and precludes the included page from containing general JSP code. <jsp:include page=" filename" flush="true"/> or <jsp:include page=" urlSpec" flush="true"> <jsp:param name="paramname" value="paramvalue" /> ... </jsp:include> A jsp:include action may have one or more jsp:param tags in its body, to provide additional name-value pairs. The included page can access the original request object, with both the original and the new parameters. If the parameter names are same, the old values are kept intact, but the new values take precedence over existing values. For example, if the request has a parameter param1=myvalue1 and a parameter param1=myvalue2 is specified in the jsp:param tag, the request received on the second JSP will have param1=myvalue2, myvalue1. The augmented attributes can be extracted from the request using the getParameter(String paramname) method in the javax.servlet.ServletRequest interface. Example<jsp:include page="two.html" flush="true"/> <br> |
filename | |
The resource to include. The URL format is the same as described in the include directive earlier. |
flush | |
In JSP 1.1 this value must always be "true", and "false" is not supported. If the value is "true", the buffer in the output stream is flushed. |