DSP tags that invoke other application components can reference those components with Relative URLs or Absolute URLs. The following DSP tags support both URL types:
Relative URLs
The src
and page
attributes of DSP tags such as dsp:include
and dsp:a
lets you specify relative URLs. The ATG platform rewrites all relative links to embedded JSP files before including the contents of the file in the parent page. Relative links are resolved as relative to the page where they are defined. This allows entire directories of the document tree to be designed independently, so they can be reused by pages in separate directories or moved to another portion of the tree.
For example, the following file tree describes the relationship between the parent JSP foyer.jsp
and two embedded files: header.jsp
and headerimage.gif
:
/testPages
foyer.jsp
/parts
header.jsp
logo.gif
foyer.jsp
embeds header.jsp
, which in turn embeds the graphic file logo.gif
:
You can implement this presentation with two DSP tags that reference the embedded files with relative paths, as follows:
In
foyer.jsp
:<dsp:include page="parts/header.jsp"/>
In
header.jsp
:<dsp:img src="./headerimage.gif"/>
The header file header.jsp
includes the image in logo.gif
, which is in the same directory. Because the header file is likely to be included by other files in various locations, the reference in header.jsp
to the image always to be relative to header.jsp
itself.
In this example, when the ATG platform compiles foyer.jsp
and resolves its links, it rewrites the img
tag so it is embedded within foyer.jsp
as follows:
<dsp:img src="/testPages/parts/headerimage.gif"/>
Absolute URLs
Tags that invoke other files such as dsp:include
can set their page
attribute to an absolute path. Absolute paths typically begin in the Web application’s root directory (war
file); however, they can begin in any location that is specified in the war
file’s web.xml
. During page compilation, the ATG platform retrieves the request object’s context
root
and adds it to the supplied page
attribute value. Thus, the tag is rewritten to include the complete URL so the page holding the URL is not limited by complex hierarchies.