资源简介
城市公交查询系统 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
相关资源
- IBM公司Java培训PPT(完整版).ppt
- JAVA sqlite JDBC驱动
- 《thinkinginjava》第三版中文版.rar
- JavaWebMVC模式实现购物网站
- 基于Java影院订票系统
- java开发的完整课程网站jsp
- 基于Java的图书馆管理系统毕业设计论
- JAVA教程97771
- 基于JSP的在线书店管理系统
- jsp高校智能排课系统
- mysql-connector-java-8.0.11.zip
- java版图书管理系统设计文档+源码
- 基于jsp开发的WEB酒店管理系统
- 拼图游戏(java 实现)
- 基于JSP的BBS论坛设计
- java程序表白代码
- CompKey算法Java实现中南大学电子商务大
- java软件设计电子商城完整源代码 数据
- java做的宿舍管理系统
- JavaWeb全栈面试题
- JSP BBS论坛
- 人才招聘网站的设计与实现
- java 做的教务管理系统
- JSP都市供求信息网
- JAVA项目-简易网吧管理系统
- JSP作业提交批改系统代码及设计
- jsp做的项目
- 宠物商店 使用JSP 技术web应用
- java 3d 网球游戏 源代码
- jsp项目---博客网.rar
评论
共有 条评论