Struts 1 磁贴帮助
我正在学习在 Struts 1.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结构吗?
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 ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的图块将成为整个 HTML 文件的一部分,该文件将通过将它们与 layout.jsp 一起放置在一起而生成。
这意味着图块必须仅包含该图块作为占位符的标记。在您的情况下,您不需要拥有完整的 HTML-HEAD-BODY 内容。在您发布的代码中,图块是页面的片段,而不是整个页面。
您仍然需要 header.jsp 、footer.jsp 和 content.jsp 文件中的页面指令和 taglib 声明,因为它们在生成的结果放置在 layout.jsp 中之前进行处理。
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.