河北金力集团公文流转系统
Posted yangqqq
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了河北金力集团公文流转系统相关的知识,希望对你有一定的参考价值。
package com.Util;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Scanner;
import org.apache.catalina.User;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Scanner;
import org.apache.catalina.User;
public class DBUtil {
public static final String connectionURL="jdbc:mysql://localhost:3306/new_schem1?useUnicode=true&characterEncoding=GB18030&useSSL=false&serverTimezone=GMT&allowPublicKeyRetrieval=true";
public static final String username="root";
public static final String password="123456";
static Connection connection;
static ResultSet rSet;
static PreparedStatement ps;
static Scanner scanner=new Scanner(System.in);
public static Connection getConnection()
{
try {
Class.forName("com.mysql.cj.jdbc.Driver");
//Class.forName("com.mysql.cj.jdbc.Driver");
return DriverManager.getConnection(connectionURL, username, password);
} catch (Exception e) {
// TODO: handle exception
System.out.println("数据库连接失败");
e.printStackTrace();
}
return null;
} //数据库连接
public static boolean getUsername() //遍历获取数据库中的内容
{
try {
Connection connection2 = getConnection();
connection=connection2;
ps= connection.prepareStatement("select * from new_schem1.jinliwenjian");
rSet=ps.executeQuery();//执行sql语句
//System.out.println("yhjyuki");
while(rSet.next())
{
System.out.println(rSet.getString(1)+" "+rSet.getString(2)+" "+rSet.getString(3)+" "+rSet.getString(4)+" "+rSet.getString(5)+" "+rSet.getString(6));
}
}
catch(SQLException e)
{
e.printStackTrace();
}
return false;
}
public static boolean dengluchaxun(bean.User user)
{
try {
connection=getConnection();
String sql="select * from jinliwenjian where username = ‘"+user.getUsername()+"‘ and password = ‘"+user.getPassword()+"‘ and status != 0";
ps= connection.prepareStatement(sql);
rSet=ps.executeQuery();
if(rSet.next()==false)
{
System.out.println("用户名或密码错误");
return false;
}
else
{
System.out.println("用户名及密码正确");
return true;
}
} catch (Exception e) {
// TODO: handle exception
}
return false;
}
public static final String connectionURL="jdbc:mysql://localhost:3306/new_schem1?useUnicode=true&characterEncoding=GB18030&useSSL=false&serverTimezone=GMT&allowPublicKeyRetrieval=true";
public static final String username="root";
public static final String password="123456";
static Connection connection;
static ResultSet rSet;
static PreparedStatement ps;
static Scanner scanner=new Scanner(System.in);
public static Connection getConnection()
{
try {
Class.forName("com.mysql.cj.jdbc.Driver");
//Class.forName("com.mysql.cj.jdbc.Driver");
return DriverManager.getConnection(connectionURL, username, password);
} catch (Exception e) {
// TODO: handle exception
System.out.println("数据库连接失败");
e.printStackTrace();
}
return null;
} //数据库连接
public static boolean getUsername() //遍历获取数据库中的内容
{
try {
Connection connection2 = getConnection();
connection=connection2;
ps= connection.prepareStatement("select * from new_schem1.jinliwenjian");
rSet=ps.executeQuery();//执行sql语句
//System.out.println("yhjyuki");
while(rSet.next())
{
System.out.println(rSet.getString(1)+" "+rSet.getString(2)+" "+rSet.getString(3)+" "+rSet.getString(4)+" "+rSet.getString(5)+" "+rSet.getString(6));
}
}
catch(SQLException e)
{
e.printStackTrace();
}
return false;
}
public static boolean dengluchaxun(bean.User user)
{
try {
connection=getConnection();
String sql="select * from jinliwenjian where username = ‘"+user.getUsername()+"‘ and password = ‘"+user.getPassword()+"‘ and status != 0";
ps= connection.prepareStatement(sql);
rSet=ps.executeQuery();
if(rSet.next()==false)
{
System.out.println("用户名或密码错误");
return false;
}
else
{
System.out.println("用户名及密码正确");
return true;
}
} catch (Exception e) {
// TODO: handle exception
}
return false;
}
public static void main(String[] args) {
// TODO 自动生成的方法存根
getUsername();
}
// TODO 自动生成的方法存根
getUsername();
}
}
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>金立文件流转系统(办公室)</title>
<script>
function check()
{
var username=document.getElementById("text1").value;
var n=/^[a-zA-Z0-9_]{4,10}$/;
if(!n.test(username)){
document.getElementById("pwspan1").innerHTML="请输入正确的用户名!";
}else{
document.getElementById("pwspan1").innerHTML="";
}
}
function check1()
{
var password1=document.getElementById("text2").value;
var n=/^[a-zA-Z0-9_]{4,10}$/;
if(!n.test(password1)){
document.getElementById("pwspan2").innerHTML="请输入正确的密码!";
}else{
document.getElementById("pwspan2").innerHTML="";
}
}
</script>
</head>
<body>
<style>
.div1{
background-color:lightseagreen;
width:1000px;
height:100px;
margin:auto;
padding-top:50px;
font-family: "微软雅黑";
font-size:40px;
}
.div2{
background: yellow;
width:500px;
height:250px;
margin: auto;
padding-top:80px;
}
.div3{
background-color:yellow;
width:300px;
height:170px;
}
.div4{
color:red;
}
</style>
<form action="Servlet?n=downland" method="post">
<div class="div1"><center><b>河北金力集团公文流转系统</b></center></div>
<div class="div2">
<center>
<div class="div3">
<h7>用户名:</h7><input type="text" maxlength="20" id="username" name="username" onblur ="check()" />
<div class="div4" id="pwspan1"></div><br/>
<center><h7> 密码:</h7><input type="password" maxlength="15" id="password" name="password" onblur="check1()">
<div class="div4" id="pwspan2"></div><br>
<a href="#"><br/><center> <input name="submit" type="submit" class="btn_grey" value="登录"><br><a>
</div>
</center>
</div>
</form>
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>金立文件流转系统(办公室)</title>
<script>
function check()
{
var username=document.getElementById("text1").value;
var n=/^[a-zA-Z0-9_]{4,10}$/;
if(!n.test(username)){
document.getElementById("pwspan1").innerHTML="请输入正确的用户名!";
}else{
document.getElementById("pwspan1").innerHTML="";
}
}
function check1()
{
var password1=document.getElementById("text2").value;
var n=/^[a-zA-Z0-9_]{4,10}$/;
if(!n.test(password1)){
document.getElementById("pwspan2").innerHTML="请输入正确的密码!";
}else{
document.getElementById("pwspan2").innerHTML="";
}
}
</script>
</head>
<body>
<style>
.div1{
background-color:lightseagreen;
width:1000px;
height:100px;
margin:auto;
padding-top:50px;
font-family: "微软雅黑";
font-size:40px;
}
.div2{
background: yellow;
width:500px;
height:250px;
margin: auto;
padding-top:80px;
}
.div3{
background-color:yellow;
width:300px;
height:170px;
}
.div4{
color:red;
}
</style>
<form action="Servlet?n=downland" method="post">
<div class="div1"><center><b>河北金力集团公文流转系统</b></center></div>
<div class="div2">
<center>
<div class="div3">
<h7>用户名:</h7><input type="text" maxlength="20" id="username" name="username" onblur ="check()" />
<div class="div4" id="pwspan1"></div><br/>
<center><h7> 密码:</h7><input type="password" maxlength="15" id="password" name="password" onblur="check1()">
<div class="div4" id="pwspan2"></div><br>
<a href="#"><br/><center> <input name="submit" type="submit" class="btn_grey" value="登录"><br><a>
</div>
</center>
</div>
</form>
</body>
</html>
</html>
package com.Servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.Util.DBUtil;
import bean.User;
/**
* Servlet implementation class Servlet
*/
@WebServlet("/Servlet")
public class Servlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public Servlet() {
super();
// TODO Auto-generated constructor stub
}
* Servlet implementation class Servlet
*/
@WebServlet("/Servlet")
public class Servlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public Servlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
response.getWriter().append("Served at: ").append(request.getContextPath());
String id=request.getParameter("id");
String username=request.getParameter("username");
String password=request.getParameter("password");
String permissionid=request.getParameter("permissionid");
String job=request.getParameter("job");
String status=request.getParameter("status");
User user=new User();
if(request.getParameter("n").equals("downland"))
{
String username1=request.getParameter("username");
user.setUsername(username1);
String password1=request.getParameter("password");
user.setPassword(password1);
DBUtil.dengluchaxun(user);
}
}
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
response.getWriter().append("Served at: ").append(request.getContextPath());
String id=request.getParameter("id");
String username=request.getParameter("username");
String password=request.getParameter("password");
String permissionid=request.getParameter("permissionid");
String job=request.getParameter("job");
String status=request.getParameter("status");
User user=new User();
if(request.getParameter("n").equals("downland"))
{
String username1=request.getParameter("username");
user.setUsername(username1);
String password1=request.getParameter("password");
user.setPassword(password1);
DBUtil.dengluchaxun(user);
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
package bean;
public class User {
protected int id;
protected String username;
protected String password;
protected String permissionid;
protected String job;
protected int status;
protected int id;
protected String username;
protected String password;
protected String permissionid;
protected String job;
protected int status;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPermissionid() {
return permissionid;
}
public void setPermissionid(String permissionid) {
this.permissionid = permissionid;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
以上是关于河北金力集团公文流转系统的主要内容,如果未能解决你的问题,请参考以下文章