http://www.doozz.com 2000-12-18 00:00 T|T
jsp留言板源代码一: 给jsp初学者.
作 者: precom (皮蛋)
oracle数据表创建.
create table guestbook (
lw_title varchar2(100) not null, --留言主题
lw_author varchar2(20) not null, --网上大名 pk
author_http varchar2(40) , --主页地址
author_email varchar2(40) not null,--电子信箱 pk
expression varchar2(2) not null,--表情
lw_time varchar2(14) not null,--发表回应时间
answer_num number(3) not null,--回应数
click_num number(4) not null,--点击数
author_ip varchar2(16) ,--来源ip
lw_class1 varchar2(10) not null,--留言板大类 pk
lw_class2 varchar2(20) not null,--论坛栏目 pk
lw_type varchar2(1) not null,--留言类别,即是否为主贴
zt_time varchar2(14) ,--主贴时间
zt_author varchar2(40) ,--主贴email
lw_content varchar2(4000) ,--内容
constraint pk_guestbook primary key(lw_class1,lw_class2,lw
_time,lw_author)
) storage (initial 5M next 5M pctincrease 1);
本文来自: 站长之家(http://www.doozz.com) 详细出处参考:http://www.doozz.com/View/30/30010403/5553.html
jsp留言板源代码二: 给jsp初学者.
http://www.doozz.com 2000-12-18 00:00 T|T
作 者: precom (皮蛋) 2000.12.10
guestbook.jsp
===========================
<%@ page contentType="text/html; charset=GB2312" %>
<%@ page language="java" import="java.sql.*" %>
<%
int pages=1;
int pagesize=10;
int count=0;
int totalpages=0;
String countsql="",inqsql="",lwhere="",insertsql="",st="";
String lw_title="",lw_author="",pagetitle="",author_http="",author_e
mail="",lw_ico="",
lw_content="",lw_class1="";
String author_ip="",lw_time="",lw_class2="",lw_type="",zt_time="",zt
_author="";
int answer_num=0,click_num=0;
int inquire_item=1;
String inquire_itemt="",inquire_value="";
| 00%\\">"+ " 共 "+totalpages+" 页,"+count+" 条. "+" 当前页: "+pages+ " |
out.print(st);
//out.print(" 共 "+totalpages+" 页,"+
count+" 条. "+" 当前页: "+pages+"
");
st="
"
| " color=#ffffff>留言主题 | "+" color=#ffffff>回应数 | "+" color=#ffffff>点击数 | "+" color=#ffffff>作者名 | "+" color=#ffffff>发表/回应时间 |
| ["+answer_num+"] | "+"+click_num+" | "+il+"\\">"+lw_author+" | "+"+st+" |
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 { //for(i=1;i<=n;i++) out.print(""+i+">"+i+" "); //out.print(" String lt1="返回主页",lt2="第一页",lt3="上一页",lt4="下一 页",lt5="最后一页",lt6=""; lt6=""+ lt1 + " a>"+ lurlt + "pages="+iFirst+">"+lt2+"&nbs p; lurlt + "pages="+iPre+">"+lt3+" " + lurlt + "pages="+iNext+">"+lt4+" ; " + lurlt + "pages="+iLast+">"+lt5+" ; "; st=""+ " " lt6+ " out.print(st); } } } catch (Exception e) { out.println("error: "+e); } } %> <% //留言板界面尾部 String lbottom=""; lbottom=lbottom+ " \\n"+ "
">");0 width=\\"95%\\"> "+
00%\\">"+
";
out.print(lbottom);
%>
本文来自: 站长之家(http://www.doozz.com) 详细出处参考:http://www.doozz.com/View/30/30010403/5552.html
jsp留言板源代码三: 给jsp初学者.
http://www.doozz.com 2000-12-18 00:00 T|T
作 者: precom (皮蛋) 2000.12.10
reply.jsp
====================================
<%@ page contentType="text/html; charset=GB2312" %>
<%@ page language="java" import="java.sql.*" %>
<%
int pages=1;
int pagesize=10;
int count=0;
int totalpages=0;
String countsql="",inqsql="",updatesql="",lwhere="",insertsql="",st=
"";
String lw_title="",lw_author="",pagetitle="",author_http="",author_e
mail="",lw_ico="0",
lw_content="",lw_class1="";
String author_ip="",lw_time="",lw_class2="",lw_type="",zt_time="",zt
_author="";
int answer_num=0,click_num=0;
int inquire_item=1;
String inquire_itemt="",inquire_value="";
| 00%\\">"+ " 共 "+totalpages+" 页,"+count+" 条. "+" 当前页: "+pages+ " |
out.print(st);
//out.print(" 共 "+totalpages+" 页,"+
count+" 条. "+" 当前页: "+pages+"
");
st="
"
| " color=#ffffff>留言主题 | "+" color=#ffffff>回应数 | "+" color=#ffffff>点击数 | "+" color=#ffffff>作者名 | "+" color=#ffffff>发表/回应时间 |
| " color=#0000cd>留言主题:" +lw_title+" | "+#0000cd>留言时间:"+st+" |
| " width=\\"700\\" wrap=yes> "+lw_content+" | |
" color=#0000cd>作者:"+lw_author+" " color=#0000cd>来源:"+author_ip+" | |
"
首页
"
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 { //for(i=1;i<=n;i++) out.print(""+i+">"+i+" "); //out.print(" String lt1="返回主页",lt2="第一页",lt3="上一页",lt4="下一 页",lt5="最后一页",lt6=""; lt6=""+ lt1 + " a>"+ lurlt + "pages="+iFirst+">"+lt2+"&nbs p; lurlt + "pages="+iPre+">"+lt3+" " + lurlt + "pages="+iNext+">"+lt4+" ; " + lurlt + "pages="+iLast+">"+lt5+" ; "; st=""+ " " lt6+ " out.print(st); } } } catch (Exception e) { out.println("error: "+e); } } %> <% //留言板界面尾部 String lbottom=""; lbottom=lbottom+ " " out.print(lbottom); %> 本文来自: 站长之家(http://www.doozz.com) 详细出处参考:http://www.doozz.com/View/30/30010403/5551.html jsp留言板源代码四: 给jsp初学者. http://www.doozz.com 2000-12-18 00:00 T|T 作 者: precom (皮蛋) 其中的opDb.java ============================================ package ymbean; import java.sql.*; import java.util.*; import java.text.*; import com.chinazjj.sql.dsql; import com.chinazjj.util.dutil; //其他的包dsql,dutil中的内容我就不再贴了,在本文件中用到的两个函数都很简 单 public class opDb { private String inquire_value="",inquire_item="",disptype="",inqtyp e=""; private String inquire_num="",inquire_addr="",inquire_name=""; private dutil ldutil=new dutil(); public opDb() { } public void setinquire_item(String name) { inquire_item= name ;} public void setinquire_value( String name ) { inquire_value = ldut il.chineseToUnicode(name);} public void setdisptype(String name) { disptype=name;} public void setinqtype(String name) { inqtype=name;} public void setinquire_num( String name ) { inquire_num = ldutil.c hineseToUnicode(name);} public void setinquire_addr( String name ) { inquire_addr = ldutil .chineseToUnicode(name);} public void setinquire_name( String name ) { inquire_name = ldutil .chineseToUnicode(name);} public String getinquire_dndata() { return ""; } public ResultSet executeQuery(String sql) { ResultSet rs = null; Statement lstmt = null; try { lstmt = connectdb(); rs = lstmt.executeQuery(sql); System.out.println("executeQuery: "+sql); } catch(SQLException ex) { System.err.println("executeQuery: " + ex.getMessage());} return rs; } public Statement getStmt() { Statement lstmt = null; lstmt = connectdb(); return lstmt; } public String executeUpdate(String sql) { ResultSet rs = null; Statement lstmt = null; try { lstmt = connectdb(); lstmt.executeUpdate(sql); System.out.println("executeUpdate: "+sql); lstmt.executeUpdate("commit"); } catch(SQLException ex) { System.err.println("executeQuery: " + e x.getMessage()); return(ex.getMessage()); } return("executeUpdate ok"); } public Statement connectdb() { Statement lstmt=null; Connection conn=null; final String connect_string="jdbc:oracle:thin:scott/tiger@192.168. 0.1:1521:clubdb"; final String driver_string="oracle.jdbc.driver.OracleDriver"; dsql mysql=new dsql(); lstmt=mysql.dconnectdb(driver_string,connect_string); return lstmt; } public Statement connectdb(String connect_string) { Statement lstmt=null; Connection conn=null; final String driver_string="oracle.jdbc.driver.OracleDriver"; dsql mysql=new dsql(); lstmt=mysql.dconnectdb(driver_string,connect_string); return lstmt; } //=========other function =================================== public String getCurrentDate(String ldateform) { return(new SimpleDateFormat(ldateform).format(new java.util.Date( ))); } //========"/n" to " //去掉奇怪的: public String removeComment(String Content){ String makeContent=new String(); StringTokenizer strToken=new StringTokenizer(Content,"\\n"); String tempToken=null; while(strToken.hasMoreTokens()){ tempToken=strToken.nextToken(); if(tempToken.indexOf(":")!=0) makeContent=makeContent+tempToken+"\\n"; } return makeContent; } //将/n转换成为回车 public String addBr(String Content){ String makeContent=new String(); StringTokenizer strToken=new StringTokenizer(Content,"\\n"); while(strToken.hasMoreTokens()){ makeContent=makeContent+" } return makeContent; } //将 public String addCr(String Content){ String makeContent=new String(); StringTokenizer strToken=new StringTokenizer(Content," while(strToken.hasMoreTokens()){ makeContent=makeContent+"\\n"+strToken.nextToken(); } return makeContent; } //==================================================================== ===== public boolean getIdentify(String name1,String pwd1) { try { String sql="select * from club_users where username='" + name1 + "' and password='" + pwd1 + "'"; ResultSet rs = executeQuery(sql); if(rs.next()) { rs.close(); return(true);} else { rs.close();return(false);} }catch (Exception e) { return(false);} } public void counts(String pagename) { executeUpdate("update call_count set counts=counts + 1 where pagenam e='"+pagename+"'"); } //==================张家界市民虚拟社区管理============================ ====== public String getDeptSuper(String vp) //取版主 { String vst="未知"; try{ String sql="select administrator from club_cvcdept where deptno= '"+vp+"'"; ResultSet rs = executeQuery(sql); if(rs.next()) vst=rs.getString(1); rs.close(); } catch (Exception e) {} return vst; } public String getDeptName(String vp) //取版名 { String vst="未知"; try{ String sql="select deptnote from club_cvcdept where deptno='"+vp +"'"; ResultSet rs = executeQuery(sql); if(rs.next()) vst=rs.getString(1); rs.close(); } catch (Exception e) {} return vst; } public String getUserEmail(String vp) //取社区用户email { String vst="未知"; try{ String sql="select email from club_users where username='"+vp+"' "; ResultSet rs = executeQuery(sql); if(rs.next()) vst=rs.getString(1); rs.close(); } catch (Exception e) {} return vst; } public Object getaValue(String vp) //取社区用户email及其他 { Object vst=null; try{ String sql=vp; ResultSet rs = executeQuery(sql); if(rs.next()) vst=rs.getObject(1); rs.close(); } catch (Exception e) {} return vst; } public String getsValue(String vp) //取社区用户email及其他 { String vst=""; try{ String sql=vp; ResultSet rs = executeQuery(sql); if(rs.next()) vst=rs.getString(1); rs.close(); } catch (Exception e) {} return vst; } }//end opDb.java 本文来自: 站长之家(http://www.doozz.com) 详细出处参考:http://www.doozz.com/View/30/30010403/5550.html下载本文
">");0 width=\\"95%\\"> "+
00%\\">"+
";
" =====================================
"+strToken.nextToken();
转换成为回车/n
");
Copyright © 2019-2025