You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@apache.org on 2001/04/29 07:31:14 UTC

cvs commit: jakarta-struts/web/template-example introduction.html

craigmcc    01/04/28 22:31:14

  Modified:    web/template-example introduction.html
  Log:
  Update the examples included in the introductory text so that they are not
  identical.
  
  Revision  Changes    Path
  1.5       +11 -15    jakarta-struts/web/template-example/introduction.html
  
  Index: introduction.html
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/template-example/introduction.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- introduction.html	2001/04/29 03:42:32	1.4
  +++ introduction.html	2001/04/29 05:31:14	1.5
  @@ -5,7 +5,7 @@
   <p class="Paragraph">JSP does not provide direct support for encapsulating layout, so web pages with identical formats usually replicate layout code; for example, <b>A Web Page Layout</b> shows a web page containing sections for a header, footer, sidebar, and main content.</p>
   <p class="Paragraph">The layout of the page shown in <b>A Web Page Layout</b> is implemented with HTML table tags, as listed in Including Content.</p>
   <p><img src="graphics/templates-1.gif"></p>
  -<h4 class="CodeCaption">Including Content</h6>
  +<h4 class="CodeCaption">Including Content</h4>
   <p class="Example-Code">
   &lt;html>&lt;head>&lt;title>Templates&lt;/title>&lt;/head><br>
   &lt;body background='graphics/blueAndWhiteBackground.gif'></p>
  @@ -22,21 +22,17 @@
   &lt;/table><br>
   &lt;/body>&lt;/html></p>
   <p class="Paragraph">In Including Content, content is included with &lt;jsp:include> which allows content to vary without modifying HTML; however, because the layout is hardcoded, layout changes require modifications to the page. If a website has many pages with identical formats, even simple layout changes require modifications to all of the pages.</p>
  -<h4 class="ChapTitle">Including Dynamic Content</h4>
  +<h4 class="ChapTitle">Using A Template</h4>
   <br>
   <p class="Example-Code">
  -&lt;html>&lt;head>&lt;title>Templates&lt;/title>&lt;/head><br>
  -&lt;body background='graphics/blueAndWhiteBackground.gif'></p>
  +&lt;%@ taglib URI='/WEB-INF/struts-template.tld' prefix='template' %></p>
   <p class="Example-Code">
  -&lt;table width='610'><br>
  -&lt;tr valign='top'>&lt;td>&lt;jsp:include page='sidebar.jsp'/>&lt;/td><br>
  -&lt;td>&lt;table><br>
  -&lt;tr>&lt;td>&lt;jsp:include page='header.html'/>&lt;/td>&lt;/tr><br>
  -&lt;tr>&lt;td>&lt;jsp:include page='chapter.jsp'/>&lt;/td>&lt;/tr><br>
  -&lt;tr>&lt;td>&lt;jsp:include page='footer.jsp'/>&lt;/td>&lt;/tr><br>
  -&lt;/table><br>
  -&lt;/td><br>
  -&lt;/tr>&nbsp;<br>
  -&lt;/table><br>
  -&lt;/body>&lt;/html></p>
  +&lt;template:insert template='/chapterTemplate.jsp'><br>
  +   &lt;template:put name='title' content='Templates' direct='true'/><br>
  +   &lt;template:put name='header' content='/header.html'/><br>
  +   &lt;template:put name='sidebar' content='/sidebar.jsp'/><br>
  +   &lt;template:put name='content' content='/introduction.html'/><br>
  +   &lt;template:put name='footer' content='/footer.html'/><br>
  +&lt;/template:insert></p>
  +
   <p class="Paragraph">To minimize the impact of layout changes, a mechanism is needed for dynamically including layout in addition to content. That way, both layout and content can be changed without modifying files that use them. For large websites that have many pages with identical formats, such a mechanism is valuable because it localizes changes to layout. That mechanism is JSP templates.</p>