我正在学习使用Struts1.3中的tiles插件。
我创建了layout.jsp,如下所示:
<%@ 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>我的问题是,header.jsp、footer.jsp和content.jsp需要分别有一个页面指令和一个完整的html-head-body结构吗?
发布于 2011-03-17 04:39:27
您的tiles将是整个HTML文件的一部分,该文件将通过将它们与layout.jsp放在一起生成。
这意味着平铺必须只包含平铺是其占位符的标记。在您的例子中,您不需要拥有完整的HTML-HEAD-BODY内容。在您发布的代码中,tiles是页面的片段,而不是整个页面。
您仍然需要在header.jsp、footer.jsp和content.jsp文件中使用页面指令和标记库声明,因为在将它们生成的结果放入layout.jsp之前对它们进行了处理。
https://stackoverflow.com/questions/5308383
复制相似问题