資源描述:
《論壇--jsp設(shè)計(jì)代碼》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫。
1、論壇的首頁效果圖:3、核心代碼:在論壇的開發(fā)中,對(duì)于一些公用的模塊,我們采用組建的方式實(shí)現(xiàn)。以下是關(guān)于數(shù)據(jù)連接的JavaBean。packagefrola;importjava.io.*;importjava.sql.*;publicclassjdbc{publicjdbc(){}Connectionconn=null;publicjava.sql.ConnectiongetConn()//數(shù)據(jù)庫連接函數(shù),返回一個(gè)數(shù)據(jù)庫連接對(duì)象{try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").n
2、ewInstance();user="+use+"&password="+pass+"&useUnicode=true&characterEncoding=gb2312";10conn=DriverManager.getConnection("jdbc:odbc:bbsdata","","");}catch(Exceptione){e.printStackTrace();System.out.println("數(shù)據(jù)庫連接失敗!");}returnthis.conn;}publicStringgetTime()//獲取當(dāng)前系統(tǒng)時(shí)間,
3、返回當(dāng)前時(shí)間字符串{Stringdatestr="";try{java.text.DateFormatdf=newjava.text.SimpleDateFormat("yyyy-M-dHH:ss");java.util.Datedate=newjava.util.Date();datestr=df.format(newjava.util.Date());}catch(Exceptionex){}returndatestr;}}截圖界面如下:10當(dāng)用戶填寫完個(gè)人信息之后,點(diǎn)擊立即注冊(cè),系統(tǒng)即會(huì)把用戶信息寫入數(shù)據(jù)庫,并返回提示頁面,
4、核心注冊(cè)代碼如下://例程1-6<%@pagecontentType="text/html;harset=gb2312";language="java"import="java.sql.*,java.util.*"%><%!StringUser_Name,User_Password,User_Password1,sql,User_Sex,User_Email,User_Address,User_Mobile,User
5、_Oicq,User_Year,User_Month,User_Day,User_Birthday,User_Icon,User_Sign;%><%User_Name=request.getParameter("name");User_Name=yy.ex_chinese(User_Name);User_Password=request.getParameter("password");User_Password=yy.ex_chinese(User_Password);User_Password1=request.getPara
6、meter("password2");User_Password1=yy.ex_chinese(User_Password1);User_Sex=request.getParameter("sex");User_Sex=yy.ex_chinese(User_Sex);10User_Email=request.getParameter("email");User_Address=request.getParameter("address");User_Address=yy.ex_chinese(User_Address);User_
7、Mobile=request.getParameter("mobile");User_Oicq=request.getParameter("oicq");User_Year=request.getParameter("year");User_Month=request.getParameter("month");User_Day=request.getParameter("day");User_Icon=request.getParameter("icon");User_Sign=request.getParameter("sig
8、n");User_Sign=yy.ex_chinese(User_Sign);if(User_Year.equals("")){if((User_Month.equals(""))&&(User_Day.equals("")))User_Birth