jsp页面中怎么实现每四张图片换行显示?在线等

a619225471 2010-11-04 04:59:27
比如
<style type="text/css">
.table { margin-left:13px; border:1px solid #f1f1f1; padding:0px; overflow:hidden; clear: both;}
.menu { width:780px;margin:0 auto;}
#menu li{
float: left;
}
</style>
<div class="table">
<ul id="menu">
<logic:iterate id="it" name="indexForm" property="infoContentList" > <li>
<table>
<tr>
<td><img height="100" width="184" src='<bean:write name="it" property="st_img)"/>'/></td>
</tr>
</table>
</li>
</logic:iterate>
</ul>
</div>
...全文
344 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
a619225471 2010-11-04
  • 打赏
  • 举报
回复
解决了哈 就这样就可以了
<table>
<logic:iterate id="it" name="indexForm" property="infoContentList" indexId="index">
${index%4==0 ? "<tr>" : "" }
<td>
<img height="100" width="184" src='<bean:write name="it" property="st_img"/>'/>
</td>
${(index+1)%4==0 ? "</tr>" : "" }
</logic:iterate>
</table>
wxx474341237 2010-11-04
  • 打赏
  • 举报
回复
Struts 1的标签忘了
<table>
<logic:iterate id="it" name="indexForm" property="infoContentList" indexId="index">
<if index%4==0>
<tr>
</if>
<td><img height="100" width="184" src='<bean:write name="it" property="st_img"/>'/>
</td>
<if index%4==0>
</tr>
</if>
</logic:iterate>
<!--打印剩余TD--!>
<if infoContentList.size%4!=0>
<logic:iterate id="it" name="indexForm" property="infoContentList" length="${infoContentList.size-infoContentList.size%4}">
<td> </td>
<tr>
</logic:iterate>
</if>
</table>
a619225471 2010-11-04
  • 打赏
  • 举报
回复
<table>
<tr>
<logic:iterate id="it" name="indexForm" property="infoContentList" indexId="index">
${index%4==0?"":""}<td><img height="100" width="184" src='<bean:write name="it" property="st_img"/>'/>
</td>
</logic:iterate>
</tr>
</table>
怎么把${index%4==0?"":""}这里面加进去啊 “”双引号里怎么写
a619225471 2010-11-04
  • 打赏
  • 举报
回复
index % 4 == 0 我用的是这个 但是<td><tr> 不知道怎么写进去
你写下代码不
<logic:iterate id="it" name="indexForm" property="infoContentList" indexId="index">
<table>
<tr>
<logic:iterate id="it" name="indexForm" property="infoContentList" indexId="index">
<td><img height="100" width="184" src='<bean:write name="it" property="st_img"/>'/>
</td>
</logic:iterate>
</tr>
</table>
怎么把${index%4==0?"":""}这里面价进去啊
penglei520 2010-11-04
  • 打赏
  • 举报
回复
当前下标 index % 4 == 0 就换行,然后判断集合的size % 4 != 0 && size ==index 也换行
a619225471 2010-11-04
  • 打赏
  • 举报
回复
<li>
<table>
<tr>
<logic:iterate id="it" name="indexForm" property="infoContentList" ><td><img height="100" width="184" src='<bean:write name="it" property="string(st_img)"/>'/></td>
</logic:iterate>
</tr>
</table>
</li>
或是不用li
就是我从后台查询了个
<logic:iterate id="it" name="indexForm" property="infoContentList" >
怎么在jsp页面中怎么实现每四张图片换行显示?
JSP下载文件说明包括两部分内容,一部分是JSP基础知识;另一部分是综合实例。读者可根据相应的使用说明直接使用这些源代码。 一、基础知识部分 此部分是指文件夹名为第1~9章的内容(如表1),这些是书介绍JSP相关知识的源代码。文件的命名规则与书相应源代码文件名一致。读者可将相关文件夹(如ch2)拷贝到Tomcat服务器安装目录的子目录webapps下,并启动Tomcat服务器,在浏览器浏览网页。 表1 第1章 序号 文件名称 位置 说明 1 SimpleJSP.jsp 第1章\ch1 第一个JSP页面 2 web.xml 第1章\ch1\WEB-INF 第1章程序应用的描述文件 表2 第2章 序号 文件名称 位置 说明 1 sample1.html 第2章\ch2 第一个HTML网页 2 sample2.html 第2章\ch2 设置HTML网页标题示例 3 sample3.html 第2章\ch2 设置HTML网页字体示例 4 sample4.html 第2章\ch2 设置HTML网页其他字体示例 5 sample5.html 第2章\ch2 换行与不换行标记示例 6 sample6.html 第2章\ch2 对齐标记示例 7 sample7.html 第2章\ch2 创建表格示例 8 sample8.html 第2章\ch2 设计表单示例 9 sample9.html 第2章\ch2 图象标记示例 10 sample10.html 第2章\ch2 链接标记示例 11 sample11.html 第2章\ch2 简单的JavaScript示例 12 sample12.html 第2章\ch2 介绍String对象示例 13 sample13.html 第2章\ch2 介绍Date对象示例 14 sample14.html 第2章\ch2 介绍Math对象示例 15 sample15.html 第2章\ch2 介绍Windows对象示例 续表 序号 文件名称 位置 说明 16 sample16.html 第2章\ch2 介绍鼠标事件示例 17 sample17.html 第2章\ch2 介绍键盘事件示例 18 sample18.html 第2章\ch2 介绍焦点事件示例 19 sample19.html 第2章\ch2 介绍调整窗口尺寸事件示例 20 sample17.html 第2章\ch2 介绍加载和卸载事件示例 21 02_1.jpg 第2章\ch2\image sample9.html使用的图片文件 22 web.xml 第2章\ch2\WEB-INF 第2章程序应用的描述文件 23 register.html 第2章\ch2 习题答案,用户注册页面 表3 第3章 序号 文件名称 位置 说明 1 Add.java 第3章\ch3 习题答案(编程题第1题) 2 Add.class 第3章\ch3 习题答案(编程题第1题) 3 Fibonacci.java 第3章\ch3 习题答案(编程题第2题) 4 Fibonacci.class 第3章\ch3 习题答案(编程题第2题) 5 Cylinder.java 第3章\ch3 习题答案(编程题第3题) 6 Cylinder.class 第3章\ch3 习题答案(编程题第3题) 表4 第4章 序号 文件名称 位置 说明 1 example.jsp 第4章\ch4 一个典型的JSP页面 2 head.jsp 第4章\ch4 include指令示例(显示标题和页头) 3 body.jsp 第4章\ch4 include指令示例(显示页体) 4 tail.jsp 第4章\ch4 include指令示例(显示页尾) 5 include.jsp 第4章\ch4 利用include指令包含上述3个JSP页面 6 example1.jsp 第4章\ch4 Scriptlet示例 7 div.jsp 第4章\ch4 处理客户请求阶段的错误示例 8 error.jsp 第4章\ch4 div.jsp页面的错误处理页面 9 web.xml 第4章\ch4\WEB-INF 第4章程序应用的描述文

67,550

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧