Reputation: 2293
I am learning to use tiles plug in in Struts 1.3 .
I have created the layout.jsp as follows :
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Layout Page</title>
</head>
<body>
<table width="90%" border="0">
<tr>
<td><tiles:insert attribute="header" /></td>
</tr>
<tr>
<td><tiles:insert attribute="content" /></td>
</tr>
<tr>
<td><tiles:insert attribute="footer" /></td>
</tr>
</table>
</body>
</html>
My question that do the header.jsp ,footer.jsp and content.jsp need to have a page directive and a full html-head-body structure individually ??
Upvotes: 0
Views: 413
Reputation:
Your tiles will be parts of the entire HTML file that will be generated from putting them all together along with the layout.jsp.
That means that the tiles must only contain the markup for which the tile is a placeholder. In your case you don't need to have full HTML-HEAD-BODY content. In the code you posted, the tiles are fragments of a page, not entire pages.
You will still need page directives and taglib declarations inside the header.jsp ,footer.jsp and content.jsp files as they are processed before the result they generate is placed inside the layout.jsp.
Upvotes: 1