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


dcontent=new String(myrs.getString("Mcontent"));
try{
dtime=new String(myrs.getObject("Mtime").toString());
}
catch(java.lang.NullPointerException e){
dtime=new String("2001-04-06 12:30");
}
if(dname==null)
dname=new String("川石");
if(demail==null)
demail=new String("yf188@21cn.com");
if(dcontent==null)
dcontent=new String("test");
if(dtime==null)
dtime=new String("2001-04-06 12:30");
dname=convert(dname);
dcontent=convert(dcontent);
//temptime=myrs.getDate("Mtime");
/*
String tempyear=String.valueOf(temptime.getYear()+1900);
String tempmonth=String.valueOf(temptime.getMonth()+1);
if(tempmonth.length()==1)
tempmonth=new String("0"+tempmonth);
String tempdays=String.valueOf(temptime.getDate());
if(tempdays.length()==1)
tempdays=new String("0"+tempdays);
String tempminute=String.valueOf(temptime.getMinutes());
if(tempminute.length()==1)
tempminute=new String("0"+tempminute);
String temphours=String.valueOf(temptime.getHours());
if(temphours.length()==1)
temphours=new String("0"+temphours);
String dtime=tempyear+" 年 "+ tempmonth +" 月 "+ tempdays +" 日 " + temphours+ " 时 "+ tempminute + " 分 ";
*/
out.println("TABLE width="600" border="0" cellspacing="0" cellpadding="4" align="CENTER" class="mytext"");
out.println("TRTD姓名 A href="mailto:"+demail+"""+dname+"/A 留言时间:"+dtime+"/TD/TR");
out.println("TRTD height="10"/TD/TR");
out.println("TRTD height="10""+dcontent+"/TD/TR");
out.println("/TABLE");
out.println("HR width="600" size="1"");
}while(myrs.next());}
catch(SQLException e){
out.println("error found");
}
}
else{
out.println("还没有留言!");
}
//结束
out.println("FORM name="form1" method="post" action="guestbookServlet"");
out.println("TABLE width="600" border="0" cellspacing="0" cellpadding="4" align="CENTER" class="mytext"");
out.println("TRTD width="80"姓名:/TDTDINPUT type="text" name="username"*/TD/TR");
out.println("TRTDEmail:/TDTDINPUT type="text" name="email"*/TD/TR");
out.println("TRTD留言:/TDTDTEXTAREA name="ucontent" cols="65" rows="4"/TEXTAREA/TD/TR");
out.println("/TABLE");
out.println("TABLE width="400" border="0" cellspacing="0" cellpadding="6" align="CENTER" class="mytext"");
out.println("TRTD height="15" width="200" /TDTD /TD/TR");
out.println("TRTDDIV align="RIGHT"INPUT type="button" name="Button" value="https://www.04ip.com/post/提 交" style="cursor:hand" onclick="javascript:check()"/DIV/TD");
out.println("TDINPUT type="reset" name="Submit2" value="https://www.04ip.com/post/重 置"/TD/TR");
out.println("/TABLE");
out.println("/FORM");
out.println("TABLE width="400" border="0" cellspacing="0" cellpadding="4" align="CENTER" class="mytext"");
out.println("TRTD width="15" /TD/TR");
out.println("TRTDDIV align="LEFT"/DIV/TD/TR");
out.println("TRTD /TD/TR");
out.println("/TABLE");
out.println("/BODY");
out.println("/HTML");
out.println("SCRIPT language="javascript"");
out.println("function check(){");
out.println("if(form1.username.value.length1||form1.ucontent.value.length1)");
out.println("{alert(姓名和留言是必须有的!);}else{form1.submit();}}");
out.println("/SCRIPT");
out.close();
}
/** Handles the HTTP codeGET/code method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
processRequest(request, response);
}
/** Handles the HTTP codePOST/code method.
* @param request servlet request
* @param response servlet response
*/

推荐阅读