|
The steps involved in the implementation of the content page
descriptor are described below.
Change the extension of the html page to active page
extension
For pages to be recognized as active content, within Struts,
they must have the .jsp extension. It is thus necessary to change the extension
accordingly, from the html or xhtml extension to the jsp extension.
PAGE DESCRIPTOR |
id |
pages/northStorm.html |
page-url |
pages/northStorm.jsp |
template |
|
description |
|
Insertion of declaration and other necessary code
segments
There are other declarations and tags that must be entered
into the page, these are shown below:
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/struts-nested" prefix="nested" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html:html>
<head>
<html:base/>
<title>Index Page</title>
</head>
<body>
//..content
</body>
</html:html>
Whereas the html:html and html:base tags are described
below.
html:html
Used to render the <html> tag.
This tag is used to set the handling of the locale setting
of the internationalizations scheme, based on browser or other setting. It also
prescribes whether the page should be XML (xhtml) conformant.
html:base
Used to render the <base> tag.
This tag renders an html base tag that defines the absolute
location of the current page. One of the problems that could come up when
converting mock html pages to Struts pages is the issue of broken links. Pages
URL as reflected in the browser, might be based on the action that forwarded to
the page, rather than the URL of the page itself. In which case, any relative
addresses that are based on the page?s location would not work, because the
action URL appears as the location. The Struts Base tag would render the html
base tag, based on the URL of the current JSP page. All relative URL would now
be resolved in reference to this base. This would give a more consistent result
than the ever changing runtime URL that might depend on the processing action.
Template
The descriptor attribute template when populated denotes the template used by the page.
PAGE DESCRIPTOR |
id |
pages/northStorm.html |
page-url |
pages/northStorm.jsp |
template |
layout/template.html |
description |
|
The typical declarations for a page using a template are shown below.
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<tiles:insert page="../layout/template.jsp" flush="true">
<tiles:put name="content" type="string">
//.... content
</tiles:put>
</tiles:insert>
There are more discussions on the use of template in the section on segment descriptor types.
More details are available in the attributes descriptions
id
page-url
description
template
|