从数据库读出来的形式是  标题1 文章...标题2 文章(5篇)...(5篇)标题3 文章...(5篇)这样的  我想让她  标题1   标题2
文章    文章
文章    文章 
文章    文章 
标题3
文章
文章
文章
怎么能办到?给出具体代码 谢谢啦 我想做新闻发布系统

解决方案 »

  1.   

    这个问题很简单啊!~!
    只需要一个简单的DIV + CSS就可以搞定了!~!
    楼主还是自己好好的做做吧!~
    不要操之过急哦1~!
    一步一步的来吧
      

  2.   

    页面设置布局的问题,建议用table搭配着jstl的foreach标签
      

  3.   


       <div class="pro">
            <sql:query var="rs" dataSource="${ds}" sql="select top ${num} * from goods where newgoods=1 order by goods_id desc"></sql:query>
              <table width="590" border="0" cellspacing="0" cellpadding="0" align="center">
              <c:set var="i" value="0"/>
        <c:forEach items="${rs.rows}" var="good">
         <c:if test="${i%3==0}">
    <tr>
    </c:if>
        
        <td width="195" align="center" valign="top"> <table width="196" height="115" border="0" cellpadding="0" cellspacing="0" class="main">
            <tr> 
              <td width="50%"><TABLE width=98 height=100 border=0 align="center" cellPadding=2 cellSpacing=1 bgColor=#e1e1e1 onmouseover="this.style.backgroundColor='#FF6600'" onmouseout="this.style.backgroundColor=''">
                <TBODY>
                  <TR>
                    <TD width=92 height=100 bgColor=#ffffff align=center>
                        <a href=list.jsp?id=${good.goods_id} target="_blank"> 
                        <c:if test="${good.goods_pic==null}">
                          <img src="/goods/noproduct.gif" alt="商品图片"  width=85 height=75 border=0 align=absmiddle>
                        </c:if>
                        <c:if test="${good.goods_pic!=null}">
                          <img src="./${good.goods_pic}" alt="商品图片" width=85 height=75 border=0 align=absmiddle>
                        </c:if>
                        </a> 
                      </TD>
                  </TR>
                </TBODY>
              </TABLE> </td>
              <td valign=middle width="50%"><a href=list.jsp?id=${good.goods_id} target="_blank">
                 <font color="#FF0000">&nbsp;
                 ${good.goods_name}
               </font></a>
       <br> <br> 
              &nbsp;现价:${good.goods_price}元<br> 
              &nbsp;原价:${good.goods_yuan_price}元
              <table width="100%" cellpadding=0 cellspacing=0>
                <tbody>
                  <tr>
                    <td width="116"><div align="center"><a href="gouwu.jsp" target="_blank" ><img src="./images/dg.gif" width="45" height="20" border=0></a><a href="/souchang?user_id=${userinfo.user_id}&goods_id=${good.goods_id}" target="_blank"><img src="./images/sc.gif" width="45" height="20" border=0></a></div></td>
                  </tr>
                </tbody>
              </table></td>
            </tr>
          </table>
          </td>
                    
         <c:set var="i" value="${i+1}"/>
    <c:if test="${i==3}">
    </tr>
    </c:if>
            </c:forEach>
    </table>
          </div>
          </div>
    自己先去看看吧!~~~
    有什么不懂给我提问哈
    还有就是,多给点分吧!~~~~