您现在的位置: 军旅同心-旅游自驾-军旅文学 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 正文
jsp留言板源代码三: 给jsp初学者.
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 14:26:41
;FONT "+
" color=#ffffff>留言主题</FONT></TD> "+
" <TD align=middle bgColor=#6699cc width=50><FONT "+
" color=#ffffff>回应数</FONT></TD> "+
" <TD align=middle bgColor=#6699cc width=40><FONT "+
" color=#ffffff>点击数</FONT></TD> "+
" <TD align=middle bgColor=#6699cc width=100><FONT "+
" color=#ffffff>作者名</FONT></TD> "+
" <TD align=middle bgColor=#6699cc width=140><FONT "+
" color=#ffffff>发表/回应时间</FONT></TD></TR> ";
//out.print(st);

if(count > 0 )
{
ResultSet rs = testInq.executeQuery(inqsql);
ResultSetMetaData metaData = rs.getMetaData();

int i;
// 跳过pages -1 页,使cursor指向pages并准备显示
for(i=1;i<=(pages - 1)*pagesize;i++) rs.next();
//显示第pages页开始
st= " <CENTER> <TABLE border=0 cellSpacing=1 width="95%"
> <TBODY> ";
out.print(st);
String linestr="";
for(i=1;i<=pagesize;i++)
if(rs.next())
{
lw_title=rs.getString("lw_title");
lw_author=rs.getString("lw_author");
lw_time=rs.getString("lw_time");
lw_content=rs.getString("lw_content");
author_ip=rs.getString("author_ip");
author_email=rs.getString("author_email");
st=lw_time.substring(0,4)+"-"+lw_time.substring(4,6)+"-"
+lw_time.substring(6,8)+":"+
lw_time.substring(8,10)+":"+lw_time.substring(10,12)+
":"+lw_time.substring(12,14);
try{lw_content=testInq.addBr(testInq.removeComment(lw_co
ntent));} catch (Exception e) {}
linestr =""+
" <TR bgColor=#bed9fc> "+
" <TD align=left width="75%"><FONT "+
" color=#0000cd>留言主题:</FONT><STRONG>"
+lw_title+"</STRONG></TD> "+
" <TD align=left width="25%"><FONT color=
#0000cd>留言时间:</FONT>"+st+"</TD></TR> "+
" <TR bgColor=#e7f1fe> "+
" <TD colSpan=2 "+
" width="700" wrap=yes><BR>"+lw_content+"
<BR><br></TD></TR> "+
" <TR bgColor=#bed9fc> "+
" <TD align=right colSpan=2 width="100%">
<FONT "+
" color=#0000cd>作者:</FONT>"+lw_author+"
<FONT "+
" color=#0000cd>来源:</FONT>"+author_ip+"
</TD></TR>";
out.println(linestr);

}
rs.close();
//显示第pages页结束
st= " </TBODY></TABLE></CENTER></DIV><BR> "+

" <CENTER><A "+
" href="guestbook.jsp"><FONT "+
" color=blue face=楷体_GB2312 size=4>返回留言板
首页</FONT></A></CENTER><BR> "+
" <HR align=center noShade SIZE=1 width="95%"
> ";

out.print(st);

int iFirst=1,iLast=totalpages,iPre,iNext;
if(pages<=1) iPre=1;
else iPre=pages - 1;

if(pages>=totalpages) iNext=totalpages;
else iNext=pages + 1;

int n=(int)(count/pagesize);
if(n*pagesize<count) n++;
if(n>1)
{
//for(i=1;i<=n;i++) out.print("<a href=inquire.jsp?pages=
"+i+">"+i+" </a>");
//out.print("<HR align=center noShade SIZE=1 width="95%
">");
String lt1="返回主页",lt2="第一页",lt3="上一页",lt4="下一
页",lt5="最后一页",lt6="";
lt6="<a href=http://www.zj.hn.cn>"+ lt1 + " </
a>"+
lurlt + "pages="+iFirst+"><FONT color=red>"+lt2+"&nbs
p; </a>"+
lurlt + "pages="+iPre+"><FONT color=red>"+lt3+"
</a>" +
lurlt + "pages="+iNext+"><FONT color=red>"+lt4+"
; </a>" +
lurlt + "pages="+iLast+"><FONT color=red>"+lt5+"
; </a>";
st=""+
" <TABLE align=center border=0 cellPadding=0 cellSpacing=
0 width="95%"> "+
" <TBODY> <TR> <TD align=middle bgColor=#97badd width="1
00%"><FONT color=#ff0000>"+
lt6+
" </FONT></TD></TR></TBODY></TABLE><BR> ";

out.print(st);

}

}
} catch (Exception e) { out.println("error: "+e); }
}


%>


<%
//留言板界面尾部
String lbottom="";
lbottom=lbottom+
" <center> "+
" <FORM action=reply.jsp method=post name=sign> "+
" <INPUT name=lw_class1 type=hidden value=cnzjj_gt> "+
" <INPUT name=lw_class2 type=hidden value="+lw_class2+"> "
+
" <INPUT name=pages type=hidden value=1> "+
" <INPUT name=zt_time type=hidden value="+zt_time+"> "+
" <INPUT name=zt_author type=hidden value="+zt_author+"> "
+
" <TABLE bgColor=#d5e8fd border=0 cellSpacing=1 width="95%"> "+

" <TBODY> "+
" <TR> "+
" <TD align=middle bgColor=#e6e6fa colSpan=2 noWrap><STRONG><FONT
color=blue "+
" face=楷体_GB2312 size=5>发 表 意 见</FONT></STRONG> &nbs
p; [加*的内容必须填写] </TD></TR> "+
" <TR> "+
" <TD noWrap width="45%"> "+
" <DIV align=left> "+
" <TABLE bgColor=#d5e8fd border=0 cellSpacing=1 width="100%">
"+
" <TBODY> "+
" <TR> "+
" <TD noWrap width="100%">*留言主题:<INPUT maxLength=40 n
ame=lw_title "+
" size=36></TD></TR> "+
" <TR> "+
" <TD noWrap width="100%">*网上大名:<INPUT maxLength=18 n
ame=lw_author "+
" size=36></TD></TR> "+
" <TR> "+
" <TD noWrap width="100%"> 主页标题:<INPUT maxLength
=40 name=pagetitle "+
" size=36></TD></TR> "+
" <TR> "+
" <TD noWrap width="100%"> 主页地址:<INPUT maxLength
=255 name=author_http "+
" size=36></TD></TR> "+
" <TR> "+
" <TD noWrap width="100%">*电子邮件:<INPUT maxLength=40 n
ame=author_email "+
" size=36></TD></TR></TBODY></TABLE></DIV></TD> "+
" <TD noWrap vAlign=top width="55%"> "+
" <DIV align=left> "+
" <TABLE bgColor=#b6d7fc border=0 cellSpacing=1 width="100%">
"+
" <TBODY> "+
" <TR> "+
" <TD width="100%">请在下面填写你的留言:</TD></TR> "+

" <TR> "+
" <TD width="100%"><TEXTAREA cols=50 name=lw_content rows=
7></TEXTAREA></TD></TR></TBODY></TABLE></DIV></TD></TR> "+
" <TR> "+
" <TD bgColor=#fbf7ea colSpan=2 noWrap>表情 "+
" <INPUT name=gifface type=radio value=1 checked><IMG "+
" alt="1.gif (152 bytes)" height=15 src="1.gif" width=15> <I
NPUT "+
" name=gifface type=radio value=2><IMG alt="2.gif (174 bytes)"
height=15 "+
" src="2.gif" width=15> <INPUT name=gifface type=radio value=3
><IMG "+
" alt="3.gif (147 bytes)" height=15 src="3.gif" width=15> <I
NPUT "+
" name=gifface type=radio value=4><IMG alt="4.gif (172 bytes)"
height=15 "+
" src="4.gif" width=15> <INPUT name=gifface type=radio value=5
><IMG "+
" alt="5.gif (118 bytes)" height=15 src="5.gif" width=15> <I
NPUT "+
" name=gifface type=radio value=6><IMG alt="6.gif (180 bytes)"
height=15 "+
" src="6.gif" width=15> <INPUT name=gifface type=radio value=7
><IMG "+
" alt="7.gif (180 bytes)" height=15 src="7.gif" width=15> <I
NPUT "+
" name=gifface type=radio value=8><IMG alt="8.gif (96 bytes)"
height=15 "+
" src="8.gif" width=15> <INPUT name=gifface type=radio value=9
><IMG "+
" alt="9.gif (162 bytes)" height=15 src="9.gif" width=15> <I
NPUT "+
" name=gifface type=radio value=10><IMG alt="10.gif (113 bytes)
" height=15 "+
" src="10.gif" width=15> <INPUT name=gifface type=radio value=
11><IMG "+
" alt="11.gif (93 bytes)" height=15 src="11.gif" width=15> <

上一页  [1] [2] [3] 下一页


更多
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 网站地图 | 版权申明 | 网站公告 | 管理登录 |