jsp之table美化

1、<table>

((1)class是style中的值,表示table使用这个class的属性

(2)cellpadding="10" 表示每个单元格的内容与四个边界的距离

(3)align="center" 表示在这个页面的方位,center表示中间

<style>
.table {
    border: 1px solid #000000;
    border-collapse: collapse;
    width
    =100%;
}

.table th {
    border: 1px solid #000000;
    border-collapse: collapse;
}

.table td {
    border: 1px solid #000000;
    border-collapse: collapse;
}
</style>


<table class="table" align="center" cellpadding="10">
        <tr>
            <%for(String title:titleList) {%>
            <th><%=title %></th>
            <%} %>
            <th>操作</th>
        </tr>
        <%for(Map<String,Object> map:product) {%>
        <tr>
            <%for(String title:titleList) {%>
            <td align="center"><%=map.get(title) %></td>
            <%} %>
            <td><a href="update_product.jsp?action=edit">修改</a> <a
                href="<%=path%>/servlet/ProductEdit?action=del&type=<%=type %>&id=<%=map.get("id") %>"
                onclick="return confirm ('确定删除?')">删除</a></td>
        </tr>
        <%} %>
    </table>

Done!

    <table align="center" cellpadding="10">
        <tr>
            <td ><input type="button"
                onclick="window.location.href='<%=path%>/servlet/ProductAdd?type=<%=type %>'"
                value="添加"></td>
            <td ><%=pageString%></td>
        </tr>
    </table>

原文地址:https://www.cnblogs.com/xingyyy/p/3486075.html