1

我在 apache tile 3.0 中呈现 html 时遇到了一些问题。当我使用浏览器并打开下面的 html 时,表格会正确呈现,第一个和第三个 td 之间没有空格。

 <html>
<head>
<title>Header</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- Save for Web Slices (Header.psd) -->
<table id="header" width="1149" height="150" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <a href="/home">
                <img src="images/Logo.png" width="330" height="109" border="0" alt=""></a></td>
        <td rowspan="2">
            <img src="images/Header.png" width="819" height="150" alt=""></td>
    </tr>
    <tr>
        <td>
            <img src="images/Header-03.png" width="330" height="41" alt=""></td>
    </tr>
</table>
<!-- End Save for Web Slices -->
</body>
</html>

但是当我在 apache tile 3.0 中使用相同的代码时,第一个和第三个 td 之间有空格。

我的 views.xml 定义如下:

<definition name="mainLayout" template="/WEB-INF/jsp/mainLayout.jsp">
      <put-attribute name="title"  value="Template"/> 
      <put-attribute name="header"   value="/WEB-INF/jspf/header.jsp"/>         
</definition>

mainLayout.jsp 定义如下:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>

<!DOCTYPE html>
<html>
<head>
<title><tiles:insertAttribute name="title" ignore="true" /></title>
<meta charset="UTF-8">
<meta name="description" content="FW 8 DW 8 XHTML" />
</head>
<body>
<div id="container" style="width:1149px; margin:0 auto;" >
<!-- Header starts here -->
<div id="header" style="height:150px;width:1149px;">
     <tiles:insertAttribute name="header" />
</div>
<!-- Header ends here -->  
</div>
</body>
</html>

header.jsp 定义如下:

<table id="header" width="1149" height="150" border="0" cellpadding="0" cellspacing="0">
<tr>
    <td><a href="/home"><img src="resources/images/Logo.png" width="330" height="109"
     border="0" alt=""></a>
    </td>
    <td rowspan="2"><img src="resources/images/Header.png" width="819" height="150" alt="">
    </td>
</tr>
<tr><td><img src="resources/images/Header-03.png" width="330" height="41" alt=""></td>
</tr>
    </table>

有人可以帮忙吗?我花了两天时间试图弄清楚这一点。对于它的价值,我使用的是 spring mvc 3.0。

谢谢。

4

1 回答 1

1

在 mainLayout.jsp 中添加以下内容可以解决问题:

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >

于 2013-08-29T00:15:04.863 回答