資源簡介
管理員,學生。老師三種用戶 本系統前臺主要使用JSP作為開發語言,后臺使用SqlServer作為數據庫管理系統,開發環境是MyEclipse,服務器采用tomcat,開發出的一個基于Web技術的B/S結構管理系統。

代碼片段和文件信息
package?service;
import?java.sql.ResultSet;
import?java.sql.SQLException;
import?javax.servlet.http.HttpSession;
import?model.TAdmin;
import?model.Tlaoshi;
import?model.Txuesheng;
import?org.directwebremoting.WebContext;
import?org.directwebremoting.WebContextFactory;
import?util.DB;
public?class?loginService
{
public?String?login(String?userNameString?userPwint?userType)
{
System.out.println(“userType“+userType);
try
{
Thread.sleep(700);
}?catch?(InterruptedException?e)
{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
}
String?result=“no“;
if(userType==0)//系統管理員登陸
{
String?sql=“select?*?from?t_admin?where?userName=??and?userPw=?“;
object[]?params={userNameuserPw};
DB?mydb=new?DB();
mydb.doPstm(sql?params);
try?
{
ResultSet?rs=mydb.getRs();
boolean?mark=(rs==null||!rs.next()?false:true);
if(mark==false)
{
?result=“no“;
}
else
{
?result=“yes“;
?TAdmin?admin=new?TAdmin();
?admin.setUserId(rs.getInt(“userId“));
?admin.setUserName(rs.getString(“userName“));
?admin.setUserPw(rs.getString(“userPw“));
?WebContext?ctx?=?WebContextFactory.get();?
?HttpSession?session=ctx.getSession();?
?session.setAttribute(“userType“?0);
?????????????session.setAttribute(“admin“?admin);
}
rs.close();
}?
catch?(SQLException?e)
{
System.out.println(“登錄失敗!“);
e.printStackTrace();
}
finally
{
mydb.closed();
}
}
if(userType==1)
{
String?sql=“select?*?from?t_laoshi?where?del=‘no‘?and?loginname=??and?loginpw=?“;
object[]?params={userNameuserPw};
DB?mydb=new?DB();
mydb.doPstm(sql?params);
try?
{
ResultSet?rs=mydb.getRs();
boolean?mark=(rs==null||!rs.next()?false:true);
if(mark==false)
{
?result=“no“;
}
else
{
?result=“yes“;
?Tlaoshi?laoshi=new?Tlaoshi();
?
?laoshi.setId(rs.getInt(“id“));
laoshi.setBianhao(rs.getString(“bianhao“));
laoshi.setXingming(rs.getString(“xingming“));
laoshi.setXingbie(rs.getString(“xingbie“));
laoshi.setNianling(rs.getString(“nianling“));
laoshi.setZhicheng(rs.getString(“zhicheng“));
laoshi.setLoginname(rs.getString(“loginname“));
laoshi.setLoginpw(rs.getString(“loginpw“));
laoshi.setDel(rs.getString(“del“));
?
?WebContext?ctx?=?WebContextFactory.get();?
?HttpSession?session=ctx.getSession();?
?session.setAttribute(“userType“?1);
?????????????session.setAttribute(“laoshi“?laoshi);
}
rs.close();
}?
catch?(SQLException?e)
{
System.out.println(“登錄失敗!“);
e.printStackTrace();
}
finally
{
mydb.closed();
}
}
if(userType==2)
{
String?sql=“select?*?from?t_xuesheng?where?del=‘no‘?and?loginname=??and?loginpw=?“;
object[]?params={
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????1944735??2012-08-10?16:15??300JSP學生選課系統\JSP學生選課系統錄像.exe
?????文件????1224105??2014-04-23?12:59??300JSP學生選課系統\JSP學生選課系統錄像.rar
?????文件???????1394??2012-08-10?15:27??300JSP學生選課系統\xuanke\.classpath
?????文件????????291??2012-08-10?15:27??300JSP學生選課系統\xuanke\.myme
?????文件???????1224??2012-02-09?00:49??300JSP學生選課系統\xuanke\.project
?????文件???????4800??2012-02-09?00:49??300JSP學生選課系統\xuanke\src\service\loginService.java
?????文件???????3213??2012-02-09?00:49??300JSP學生選課系統\xuanke\src\servlet\admin_servlet.java
?????文件???????2113??2012-02-09?00:49??300JSP學生選課系統\xuanke\src\util\DB.java
?????文件?????????61??2014-03-05?10:30??300JSP學生選課系統\xuanke\WebRoot\admin\index.jsp
?????文件???????5926??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\admin\kebiao\kebiaoAdd.jsp
?????文件???????2565??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\admin\kebiao\kebiaoAll.jsp
?????文件???????3071??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\admin\kebiao\kebiaoAll1.jsp
?????文件???????3567??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\admin\kebiao\kebiaoMana.jsp
?????文件???????6236??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\admin\left.jsp
?????文件?????????88??2013-03-29?12:10??300JSP學生選課系統\xuanke\WebRoot\admin\login.jsp
?????文件????????687??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\admin\right.jsp
?????文件???????3749??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\admin\top.jsp
?????文件???????5244??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\alaoshi\myxinxi.jsp
?????文件???????2696??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\axuesheng\kebiao\kebiao_mana_stu.jsp
?????文件???????5245??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\axuesheng\myxinxi.jsp
?????文件????????821??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\common\msg.jsp
?????文件????????797??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\common\success.jsp
?????文件???????5008??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\css\ba
?????文件???????1135??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\img\addNote.gif
?????文件???????5551??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\img\bg.gif
?????文件???????4467??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\img\bg_banner_menu.gif
?????文件????????590??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\img\bg_button_blue.gif
?????文件???????1210??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\img\bg_button_del.gif
?????文件???????1204??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\img\bg_button_update.gif
?????文件????????189??2012-02-09?00:49??300JSP學生選課系統\xuanke\WebRoot\img\bg_header.gif
............此處省略140個文件信息
- 上一篇:JSP+SQL人事工資管理系統
- 下一篇:JSP+SQL二手交易系統-畢業設計
評論
共有 條評論