Hi, can someone please let me know if there is a known bug with the struts template libs.. on how it produces html code... notice in the html output below has the <html> structure defined in the template at the end with all of the dynamic data printed ahead of it... there is definitely something wrong.. the data should be within the template structure defined..
I know this has to be a known bug.. since it's too big of a bug to not be known... also.. could you please let me know how to fix it.. Thanks, Minh <font size='5'><a name="top">Topics</a></font><p> <table width='145'> <tr><td><a href='introduction.jsp'> Introduction </a></td></tr> <tr><td><a href='using.jsp'> Using Templates </a></td></tr> <tr><td><a href='optional.jsp'> Optional Content </a></td></tr> <tr><td><a href='more.jsp'> ... and more ...</a></td></tr> </table></p> <table> <tr> <td><img src='graphics/java.gif'/></td> <td><img src='graphics/templates.gif'/></td> </tr> </table><hr> <p class="Paragraph"><i>This example application is based on <a href="http://www.javaworld.com/javaworld/jw-09-2000/jw-0915-jspweb_p.html">U sing JSP templates to encapsulate Webpage layout and encourage modular design</a> by David Geary. Follow that link for the full article, which also covers using role-based and nested templates. The template classes described in the Java World article were the basis for those included with Struts 1.0.</i></p> <h3 class="ChapTitle">Introduction</h3> <p class="Paragraph">Window toolkits typically provide a layout mechanism that positions widgets in a container; for example, AWT and Swing have layout managers, whereas VisualWorks Smalltalk has wrappers.</p> <p class="Paragraph">Because layout undergoes many changes over the course of development, it's important to encapsulate that functionality so layout can be modified with minimal impact to the rest of the application. In fact, layout managers are an example of one of the tenets of object-oriented design: encapsulate the concept that varies, which is also a fundamental theme for many design patterns.</p> <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</h4> <p class="Example-Code"> <html><head><title>Templates</title></head><br> <body background='graphics/blueAndWhiteBackground.gif'></p> <p class="Example-Code"> <table width='610'><br> <tr valign='top'><td><jsp:include page='sidebar.jsp'/></td><br> <td><table><br> <tr><td><jsp:include page='header.html'/></td></tr><br> <tr><td><jsp:include page='chapter.jsp'/></td></tr><br> <tr><td><jsp:include page='footer.jsp'/></td></tr><br> </table><br> </td><br> </tr> <br> </table><br> </body></html></p> <p class="Paragraph">In Including Content, content is included with <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">Using A Template</h4> <br> <p class="Example-Code"> <%@ taglib URI='/WEB-INF/struts-template.tld' prefix='template' %></p> <p class="Example-Code"> <template:insert template='/chapterTemplate.jsp'><br> <template:put name='title' content='Templates' direct='true'/><br> <template:put name='header' content='/header.html'/><br> <template:put name='sidebar' content='/sidebar.jsp'/><br> <template:put name='content' content='/introduction.html'/><br> <template:put name='footer' content='/footer.html'/><br> </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> <hr><p align="right"><a href='#top'><font size="1">TOP</font></a></p> <html> <head> <title>Templates</title> <link rel="stylesheet" href="css/templates.css" charset="ISO-8859-1" type="text/css"> </head> <body background='graphics/blueAndWhiteBackground.gif'> <table> <tr valign='top'> <td></td> <td><table> <tr><td></td></tr> <tr><td></td></tr> <tr><td></td></tr> </table> </td> </tr> </table> </body> </html>