Jsp Template

jump template

The JSP templates support the clear and flexible Model View Controller architecture. The JSP Content Assist provides multiple templates or blocks of predefined code that you can insert into a file. The WebLogic Portal provides a set of per-defined JSP templates that you can use in your applications.

Usage of originals

We will examine a JavaServer Pages (JSP) template engine that, like layouts manager, capsulates the layouts so that they can be re-used and not re-published. Since JSP does not directly encapsulate layouts, Web pages with the same format usually reproduce layouts; for example, Figure 1 shows a Web page that contains headers, footers, sidebars, and major subject areas.

HTML spreadsheet tag is used in the page shown in Figure 1: jpg''top''sidebar. html''header. html''introduction. html''footer. html' In the example above, the contents are incorporated into the JSP includes directives, which allow you to modify the contents of the page - by altering the contained data - without altering the page itself.

In order to minimise the effects of changes to the layouts, we need a system that includes the layouts as well as the contents; in this way, both the layouts and the contents can be varied without changing the data they use. These mechanisms are JSP template. These are JSPs that contain parametric contents. Most of the template described in this paper are tagged with a number of user-defined tags: template:get, template:put, and template:insert.

Template:get-tag retrieves parametric contents, as shown in Example 2. a, which creates Web pages in the formats shown in Figure 1. jpg''top''sidebar''header''content''footer' Example 2. a is almost the same as example 1 unless we use template:get instead of the includes directives.

Let us look at how template:get works. template:get gets a Java beat with the specified name from the requirement area. It contains the URI (Uniform Resource Identifier) of a web client that is integrated by template:get. In the template shown in example 2. a., template:get gets for example a URI -- header. html -- from a beam with the name headers in the solicitation area.

Then template:get sets header.html. template:put places the seeds in the requirement area, which are then fetched by template:get. This template is contained in template:insert. Sample 2. b shows how to use the put and insert tag:

Auch interessant

Mehr zum Thema