Page1.jsp
Page2.jsp
Page3.jsp
Header
Header
Header
Body-1
Body-2
Body-3
Footer
Footer
Footer
.
Limitations: Duplication of code, the same Header and Footer is included in all three pages. Solution: Separate, Header and Footer from each page. Use < jsp:include > tag for inserting Header.jsp and Footer.jsp.
Header.jsp
Footer.jsp
Page1.jsp
<jsp:include page=”/Header.jsp> |
|
<jsp:include page=”/Footer.jsp> |
Page2.jsp <jsp:include page=”/Header.jsp> |
|
<jsp:include page=”/Footer.jsp> |
Page3.jsp <jsp:include page=”/Header.jsp> |
|
<jsp:include page=”/Footer.jsp> |
Limitations: The same table structure (ie layout) is repeated in all the three pages. Solution : Separate layout from each page, and provide placeholders Include the layout in the required page using < tiles:insert page=”/Layout.jsp”> Populate the pages required using
Layout.jsp
Header.jsp
Footer.jsp
Page1.jsp
Page2.jsp
Page3.jsp
Limitations: Suppose the layout is changed to below given then we need to make changes in Layout.jsp, and in all the jsp pages which make use of Layout.jsp Header
Menu Body
Footer
Solution: Using tiles-defs.xml define all the jsp pages Using populate the jsp pages
Layout.jsp
Header.jsp
Footer.jsp
<definition name=”def1” path=”/Layout.jsp”> <definition name=”def2” path=”/Layout.jsp”>
Body1.jsp
Body2.jsp
Menu.jsp
Page1.jsp
Page2.jsp
Limitation: In tiles-defs.xml the definition tab has repeated tags
Solution: Use <definition extends=> to extend the properties of base definition <definition name=”basedef” path=”/Layout.jsp”> <definition name=”def1” extends=”basedef”> <definition name=”def2” extends=”basedef”>
Related Documents