使用集合提取显示书籍信息
来源:互联网 发布:双显卡交火软件 编辑:程序博客网 时间:2024/04/29 00:00
<%@ page language="java" contentType="text/html;charset=GBK"%>
<%@ page import="y2javaee.sg.ch03.TitlesBean"%>
<%@ page import="y2javaee.sg.ch03.BookBean" %>
<%@ page import="java.util.*" %>
<html>
<head><title>ebooks</title></head>
<body>
<table style="TEXT-ALIGN:center" width=50 border=0>
<tbody>
<!-- HTML美化代码 -->
<!-- 动态显示内容开始 -->
<%
TitlesBean titlesBean=new TitlesBean();
//调用访问数据库方法,返回所有书籍的信息列表
List titles=titlesBean.getTitles();
BookBean currentBook;
//把书籍保存在session中
session.setAttribute("titles",titles);
//对书籍列表进行遍历
for(int i=0;i<titles.size();i++){
currentBook=(BookBean)titles.get(i);
if(i%3==0){
%>
<tr>
<%} %>
<td>
<table cellSpacing=0 width=180>
<tbody>
<tr>
<td valign=bottom height=30>
<a href="displayBook.jsp?isbn=<%=currentBook.getISBN() %>">
<%=subStr(currentBook.getTitle()+","+currentBook.getEditionNumber()) %>
</a>
</td>
</tr>
<tr align=middle>
<td height=120>
<a href="displayBook.jsp?isbn=<%=currentBook.getISBN() %>">
<IMG height=110 src="/store/images/<%=currentBook.getImageFile() %>" width=90></a>//图片地址,显示集合中的图片
</td>
</tr>
</tbody>
</table><br>
</td>
<%if(i%3==2){ %>
</tr>
<%}}%>
<!-- 动态显示内容结束 -->
</tbody>
</table>
</body>
</html>
<%! //截取字符串方法
public String subStr(String str){
if(str==null||"".equals(str))
return "";
if(str.length()>20)
return str.substring(0,20)+"...";
else
return str;
}
%>
- 使用集合提取显示书籍信息
- 添加书籍信息并显示:
- 书籍信息
- C#使用正则表达式提取GPS信息
- 使用sql提取url域名信息
- 使用 Ruby 从 Web 提取信息
- 使用sed过滤提取文本中的信息
- 使用opencv提取手部信息
- 使用Palette提取图片的颜色信息
- 使用ListView显示信息
- 使用libnl显示接口信息
- 使用ListView显示信息列表
- 使用ListView显示学生信息
- 使用ListView显示信息列表
- 使用ListView显示信息列表
- 在worldpress中使用php代码抓取图书馆书籍信息
- 在worldpress中使用php代码抓取图书馆书籍信息
- delphi FMX使用模糊集合进行边缘提取
- [Java] Tread.sleep() 电子表显示时期和时间
- c
- How To Redirect stderr To stdout ( redirect stderr to a File )
- 关于WM(Window Mobile)调用WS(Web Servise)
- 解开 Windows 下的临界区中的代码死锁
- 使用集合提取显示书籍信息
- OpenPaas和CloudBees:云端的Java技术
- 完整ascii码对照表
- awk 数组
- Android JNI环境搭建及开发入门
- ubuntu install problem the configuration defaults for gnome power manager have not been installed correctly,please contact your
- 串口过滤驱动源码
- 預加重及C代碼
- 自动递增和递减 (thinking in java)