Adding an embedded file to a JSP page

You can add embedded files to your Web pages by using the jsp:include action.

Create a Web page, selecting JSP in the Template list.

This is especially useful when creating page templates. For example, you can use JSP includes to embed separate JSP files as a header or footer for your page templates. You can edit the embedded JSP file directly without having to open it.

To add a jsp:include to your Web page:

  1. Click the

    JSP Tags drawer on the palette.

  2. Drag and drop the

    Include element to your Web page. The Insert JSP Include dialog box opens.

  3. Click Browse to specify the file to embed.

  4. Add any parameters to the Parameters list. For example, you could add parameters for a user ID and password to be passed to the embedded page.

  5. Click OK. The embedded file appears in the Design page. You can now edit the embedded file directly.

If you do not want the embedded file to display in the Design page, you can turn this setting off by selecting

JSP | Show Embedded Documents Inline. The embedded page is replaced by a small icon.

Note: Page Designer cannot display embedded documents properly in the Design page when the parent document and embedded document are ill-formed. "Ill-formed" means that a HTML tag's start tag and end tag are located in separate files. Though they can work properly with an application server, Page Designer cannot display such embedded documents properly. Page Designer also cannot show embedded documents properly in the Design page when the embedded document has a <frame> or <frameset> tag.

 

Related concepts

JSP technology

 

Related tasks

Creating Web pages

Debugging JSP files

Testing JSP files on a server

Editing JSP files