| Actions in JSP |
| |
| The jsp:include Action |
| |
| This action lets us insert files into the page being generated. |
| |
| The syntax looks like this: |
|
| <jsp:include page="relative URL" flush="true" /> |
| |
| Unlike the include directive which inserts the file at the time the JSP page is translated into a servlet, this action inserts the file at the time the page is requested. This pays a small penalty in efficiency, and precludes the included page from containing general JSP code (it cannot set HTTP headers, for example), but it gains significantly in flexibility. |
| |
| For example, here is a JSP page that inserts four different snippets into a "What's New?" Web page. Each time the headlines change, authors only need to update the four files, but can leave the main JSP page unchanged. |
|
| |
|
| |
| |