Android毕业设计 服务端,毕业设计-服务端

数据库连接-sqlite

private static Connection conn = null;

private static final String DRIVER = "org.sqlite.JDBC";

private static final String URL = "jdbc:sqlite:";

private static final String FILENAME = "d:/graduation_examination.db3";

public static Connection getConnection()

{

try

{

Class.forName(DRIVER).newInstance();

conn = DriverManager.getConnection(URL + FILENAME);

if (conn != null)

{

System.out.println("-----连接成功-----");

}

}

catch (Exception e)

{

e.printStackTrace();

}

return conn;

}

public static void closeConn(Connection connection)

{

if (connection != null)

{

try

{

connection.close();

connection = null;

}

catch (sqlException e)

{

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}

public static void closePstmt(PreparedStatement pstmt)

{

try

{

if (pstmt != null)

{

pstmt.close();

pstmt = null;

}

}

catch (Exception e)

{

// TODO Auto-generated catch block

e.printStackTrace();

}

}

public static void closeRs(ResultSet rs)

{

try

{

if (rs != null)

{

rs.close();

rs = null;

}

}

catch (Exception e)

{

e.printStackTrace();

}

}

public static void closeStmt(Statement stmt)

{

if (stmt != null)

{

try

{

stmt.close();

stmt = null;

}

catch (sqlException e)

{

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}

登录界面布局代码

class="tableBorder">

background="/GraduationServer/images/login/login_bg3.gif"

class="whitenormal">

考试管理系统登录

background="/GraduationServer/images/login/login_bg1.gif"

align="center">

background="/GraduationServer/images/login/login_bg3.gif">

用户名:

background="/GraduationServer/images/login/login_bg3.gif">

background="/GraduationServer/images/login/login_bg3.gif">

密码:

background="/GraduationServer/images/login/login_bg3.gif">

align="right">

align="left">

登录验证代码实现

request.setCharacterEncoding("UTF-8");

String strNextToPage = "main.jsp";

String username = new String(request.getParameter("username")

.trim().getBytes("ISO-8859-1"),"UTF-8");

String password = new String(request.getParameter("password")

.trim().getBytes("ISO-8859-1"),"UTF-8");

String strMsgInfo = "";

if (username.equals(""))

{

strMsgInfo = "请输入用户名!";

out.println("

+ "')");

out

.println("");

return;

}

else if (password.equals(""))

{

strMsgInfo = "请输入密码!";

out.println("

+ "')");

out

.println("");

return;

}

TeacherLoginBiz teacherLoginBiz = new TeacherLoginBizImpl();

List teacherInfos = teacherLoginBiz.loginTeacheBiz(

username,password);

if (teacherInfos.size() == 1)

{

Iterator iterator = teacherInfos.iterator();

while (iterator.hasNext())

{

TeacherInfo teacherInfo = iterator.next();

System.out.println("-----id----"

+ teacherInfo.getTeacher_id() + ";----name----"

+ teacherInfo.getTeacher_name()

+ ";-------pwd------"

+ teacherInfo.getTeacher_pwd());

session.setAttribute("username",teacherInfo

.getTeacher_name());

session.setAttribute("password",teacherInfo

.getTeacher_pwd());

}

}

else

{

strMsgInfo = "登录失败,用户名或密码错误!";

}

if (!strMsgInfo.equals(""))

{

out.println("

+ "')");

out

.println("");

return;

}

out.println("

+ "';");

%>

总结

以上是编程之家为你收集整理的毕业设计-服务端全部内容,希望文章能够帮你解决毕业设计-服务端所遇到的程序开发问题。

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。

小编个人微信号 jb51ccc

喜欢与人分享编程技术与工作经验,欢迎加入编程之家官方交流群!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值