资源简介
城市公交查询系统 java jsp sql server。。。。。。。。。。。。。。。。。。。。。。

代码片段和文件信息
package com.busSystem.core;
import java.io.IOException;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class ConfirmServlet extends HttpServlet {
/**
* Constructor of the object.
*/
public ConfirmServlet() {
super();
}
/**
* Destruction of the servlet.
*/
public void destroy() {
super.destroy(); // Just puts “destroy“ string in log
// Put your code here
}
/**
* The doGet method of the servlet.
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
login(requestresponse);
}
/**
* The doPost method of the servlet.
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
login(requestresponse);
}
/**
* Initialization of the servlet.
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
}
private void login(HttpServletRequest requestHttpServletResponse response) {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
HttpSession session = request.getSession(true);//如果用户session为空,重新分配一个新的session给用户
DBConnection2 db = DBConnection2.getInstance();
String adminname = request.getParameter(“adminname“) == null ? ““ : request.getParameter(“adminname“);
adminname = exChange(adminname);//字符串乱码处理
String password = request.getParameter(“password“) == null ? ““ : request.getParameter(“password“);
password = exChange(password);//字符串乱码处理
String sql = ““;
String rand = (String) session.getAttribute(“rand“);
String input = request.getParameter(“vaild“);
int n = 0;
try {
conn = db.getConnection();
stmt = conn.createStatement();
sql = “select * from administrator where adminiID = ‘“+adminname+“‘ and adminipassword = ‘“+password+“‘“;
rs = stmt.executeQuery(sql);
if (rs.next() && rs != null) {
n++;
}
if (n > 0 && input.equals(rand)) {
session.setAttribute(“adminname“ adminna
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 72897 2007-05-15 13:04 bus.rar
文件 469513 2007-06-09 22:05 busSystem.rar
----------- --------- ---------- ----- ----
542410 2
- 上一篇:JAR2EXE破解版
- 下一篇:IBM公司Java培训PPT(完整版).ppt
相关资源
- java串口通信全套完整代码-导入eclip
- jsonarray所必需的6个jar包.rar
- JSP企业人事管理系统设计(源代码+论
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- 实现一个图书管理系统
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- JSP,SQL,MVC的选课系统
- Java编写的qq聊天室
- 基于JSP的学生宿舍管理系统(源码 数
- JSP选课管理系统
- mysql jsp网站源码下载
- JSP做的化妆品商城
- Jsp购物车实例
- 商店商品管理系统 JAVA写的 有界面
评论
共有 条评论