<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.sql.*" %>
<%@ page import="sun.jdbc.rowset.*;" %>
<%request.setCharacterEncoding("GBK");%>
<%//得到隐藏域的值
String doCreate = request.getParameter("doCreate");
String uname = request.getParameter("uname");
String psw = request.getParameter("psw");
if (doCreate==null){doCreate="false";}
//这说明提交过来了数据
if (doCreate.equals("true"))
{
//执行增加操作,要判断主键是否重复-1,
CachedRowSet resultPage=null;
resultPage=Dl.getRowSet("select * from dl where uname='"+uname+"'");
if (resultPage.next()){
resultPage=Dl.getRowSet("select * from dl where uname='"+uname+"' and psw='"+psw+"'");
if (resultPage.next()){
//登陆成功处理
String tname=resultPage.getString("tname");
session.setAttribute("tname", tname);
session.setAttribute("uname", uname);
response.sendRedirect("index.htm");
return;
}
}
%>
alert("用户名或者密码错误!");
history.back();
<%
}
%>
系统页面登陆function checkInput()
{
if (document.dlym.uname.value==""){
alert("请输入用户名!");
document.dlym.uname.focus();
return false;}
if (document.dlym.psw.value==""){
alert("请输入密码!");
document.dlym.psw.focus();
return false;}
return true;
}
登陆信息
用户名:密码:
我帮你写 你把你的工资发我好不 嘿嘿
这应该用html...javascript.jsp写.这就是个小的工程.