A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 冷月 高级黑马   /  2013-10-21 19:40  /  1212 人查看  /  5 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

我在jsp页面中,用表格显示获取到的数据,如果有多组数据,页面中的表格是默认的纵向排列,如何改为横向显示呢?
默认的显示:



jsp中的主体代码如下:
<table width="260" border="0">
<struts:action name="selectBookBySort" executeResult="false" />
    <struts:iterator value="#request['bookInfo']" id="bookInfo">
    <tr>
  <tr>
    <td width="70" height="70" rowspan="3"><img src="/onLineBookStore/bookImages/<struts:property value="#bookInfo.picture"/>" width="70"></td>
    <td width="40"><font size="-1" color="#000000">书名:</font></td>
    <td width="123"><FONT size="-1" face="宋体 " color="#000000"><struts:property value="#bookInfo.bookName"/></FONT></td>
  </tr>
  <tr>
    <td><font size="-1" color="#FF0000">价格:</font></td>
    <td><FONT size="-1" face="宋体 " color="#000000"><struts:property value="#bookInfo.price" /></FONT></td>
  </tr>
  <tr>
    <td><font size="-1" color="#FF0000">折扣:</font></td>
    <td><FONT size="-1" face="宋体 " color="#000000"><struts:property value="#bookInfo.discount" /></FONT></td>
  </tr>
  <tr>
    <td><font size="-1" color="#000000">图书简介:</font></td>
    <td colspan="2"><FONT size="-1" face="宋体 " color="#000000"><struts:property value="#bookInfo.discription" /></FONT></td>
  </tr>
  <tr>
    <td><font size="-1" color="#000000">库存信息:</font></td>
    <td><FONT size="-1" face="宋体 " color="#000000"><struts:property value="#bookInfo.inventory" />本</FONT></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><font size="-1" color="#000000">我要购买:</font></td>
    <td colspan="2"><form action="addCart.action" method="post">
       <input type="text" name="count" size=4 value="1"/>
       <input type="hidden" name="bookId" value="<struts:property value="#bookInfo.id" />"/>
       <input type="submit" value="购买"/>
       </form></td>
  </tr>
  </struts:iterator>
</table>

评分

参与人数 1技术分 +1 收起 理由
李江 + 1 很给力!

查看全部评分

5 个回复

倒序浏览
实际开发中一般都是用DIV标签结合CSS样式来做的,表格的话很难搞啊。
回复 使用道具 举报
so easy   你说的不是技术问题·w3c足够你解决
回复 使用道具 举报
那你使用表格嵌套,表格中嵌套表格,这样就可以横向排着了!
回复 使用道具 举报
冯超 发表于 2013-10-22 15:48
so easy   你说的不是技术问题·w3c足够你解决

我out了 呵呵
回复 使用道具 举报
杨增坤 发表于 2013-10-22 16:53
那你使用表格嵌套,表格中嵌套表格,这样就可以横向排着了!

嗯嗯   我试试看
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马