java手机论坛开源代码 java开发论坛网站( 三 )


if(ipage==null||ipage.length()==0)
currentPage=1;
else
currentPage=Integer.parseInt(ipage);
if((username==null||username.length()==0)||(ucontent==null||ucontent.length()==0))empty=true;
else empty=false;
Date myDate=new Date();
//String intime=new String(String.valueOf(myDate.getYear()+1990)+String.valueOf(myDate.getMonth()));
String year=String.valueOf(myDate.getYear()+1900);
String month=String.valueOf(myDate.getMonth()+1);
if(month.length()==1)
month=new String("0"+month);
String days=String.valueOf(myDate.getDate());
if(days.length()==1)
days=new String("0"+days);
String hours=String.valueOf(myDate.getHours());
if(hours.length()==1)
hours=new String("0"+hours);
String minutes=String.valueOf(myDate.getMinutes());
if(minutes.length()==1)
minutes=new String("0"+minutes);
String intime=year+"-"+month+"-"+days+" "+hours+":"+minutes;
if(email==null||email.length()==0)
email=new String("");
if(!empty){
//username=convert(username);
//email=convert(email);
//ucontent=convert(ucontent);
sqlStr="insert into Mintegbook(Mname,Memail,Mcontent,Mtime,Mid) values("+username+","+email+","+ucontent+","+intime+",1)";
getDsnConn();
executeInsert(sqlStr);
}
sqlStr=new String("select Mname,Memail,Mcontent,Mtime from Mintegbook order by Mtime DESC");
getDsnConn();
reccount=getRecordCount("Mintegbook");
if(reccount==0)
noResult=true;
else
noResult=false;
if(!noResult){
int ipageSize=10;
totalPage=getTotalPage("Mintegbook",ipageSize);
if(currentPagetotalPage)
currentPage=totalPage;
int cursor=(currentPage-1)*ipageSize+1;
try{
myrs=executeScrollableQuery(sqlStr);
myrs.absolute(cursor);
}
catch(SQLException e){
noResult=true;
}
}
out.println("HTMLHEADTITLE我的Servlet留言板/TITLE");
out.println("META http-equiv="Content-Type" content="text/html; charset=gb2312"");
out.println("STYLE type="text/css"");
out.println("!--");
out.println(".mytext { font-family: "宋体"; font-size: 12px}");
out.println(" --");
out.println("/STYLE");
out.println("/HEAD");
out.println("BODY bgcolor="#FFFFFF" text="#000000"");
out.println("TABLE width="600" border="0" cellspacing="0" cellpadding="0" align="CENTER" class="mytext"");
out.println("TRTD height="22" | a href=""我的主页/a | 我的Servlet留言板(A href="mailto:yf188@21cn.com"川石/A制作)/TD/TR");
out.println("TRTD height="1" bgcolor="#999933"/TD/TR");
out.println("/TABLE");
out.println("BR");
out.println("TABLE width="600" border="0" cellspacing="0" cellpadding="0" align="CENTER" class="mytext"");
out.println("TRTD height="8"/TD/TR");
out.println("TRTD height="18" bgcolor="#f7f7f7"DIV align="right"");
out.println("共有 "+reccount + " 条留言 ");
out.println(" 当前第font color=#ff0000"+currentPage+"/font/共 "+totalPage+" 页 ");
if(currentPage1)
out.println(" a href=https://www.04ip.com/post/guestbookServlet?ipage=1首页/a a href=https://www.04ip.com/post/guestbookServlet?ipage="+(currentPage-1)+"上一页/a ");
else
out.println(" 首页 上一页 ");
if(currentPagetotalPage)
out.println(" a href=https://www.04ip.com/post/guestbookServlet?ipage="+(currentPage+1)+"下一页/a a href=https://www.04ip.com/post/guestbookServlet?ipage="+totalPage+"末页/a ");
else
out.println(" 下一页 末页 ");
out.println("/DIV/TD/TR");
out.println("/TABLE");
out.println("BR");
//这里是显示留言内容
if(!noResult){
String dname;
String demail;
String dcontent;
String dtime;
Date temptime;
try{
do{
dname=new String(myrs.getString("Mname"));
demail=new String(myrs.getString("Memail"));

推荐阅读