Jakarta > Tapestry
Jakarta
 

Shell

Provides the outer 'shell' of a page, including the <html>, <head> and <title> tags, but not the <body> tag (which is typically provided by a Body component).

Most Tapestry pages will include a Shell component enclosing a Body component. The Shell is used to resolve the page's HTML stylesheet and the Body component manages dynamically generated JavaScript.

When designing the look and feel of a Tapestry page, include the normal HTML elements before the Shell component, including a <link rel="stylesheet"> element, so that the page will render normally in a web browser, but use a <span jwcid="$content$"> around the actual content.

See also: org.apache.tapestry.html.Shell, Body, PageLink

Parameters

Name Type Direction Required Default Description
title String in yes   The title for the page, used to render the <title> tag.
stylesheet IAsset in no   If provided, then a <link> to the stylesheet is generated.
stylesheets Array or collection of IAsset in no   If provided, then <link> elements are created for each stylesheet asset.
doctype String in no HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" Used to specify the full definition of the DOCTYPE element in the response page.
renderContentType boolean in no true If true (the default), then a <meta> tag will be written to set the content type of the page.
refresh int in no   If provided, then a <meta> tag will be written to cause a page refresh. The parameter value is the number of seconds before the refresh.
delegate IRender in no   If specified, the delegate is rendered before the close of the <head> tag. Typically, this is used to provide additional <meta> tags.
renderBaseTag boolean in no true Specifies whether or not to render the html basetag element in the document head.

Body: allowed

Informal parameters: forbidden

Reserved parameters: none

Examples

The Shell component is used here to provide the page's stylesheet and title.

In this example, the Login.html template is in the login subdirectory of the root application context. The stylesheet is within the styles directory, below the root application context.

login/Login.html:

<html>
<head>
 <link rel="stylesheet" type="text/css" href="../styles/style.css"/>
 <title>MyCorp Customer Login</title>
</head>

<span jwcid="$content$">
<span jwcid="@Shell" stylesheet="asset:stylesheet" title="MyCorp Customer Login">
<body jwcid="@Body">

<h1>Customer Login</h1>
Welcome to MyCorp's Customer Portal secure login page.

. . .

</body>
</span>
</span>
</html>

WEB-INF/login/Login.page:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC 
  "-//Apache Software Foundation//Tapestry Specification 4.0//EN" 
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
  
<page-specification>

  . . .
  
  <asset name="stylesheet" path="styles/style.css"/>
   
</page-specification>

Note that for page and component specifications stored in the web application context (even under WEB-INF), relative asset paths are computed from the root application context directory.