一个简单的JSP登陆代码
来源:互联网 发布:effective java mobi 编辑:程序博客网 时间:2024/06/04 23:36
<%@ page contentType="text/html; charset=GBK" %> <jsp:useBean id="Dl" scope="request" class="dlxx.Dl" /> <%@ 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; } } %> <script language="javascript"> alert("用户名或者密码错误!"); history.back(); </script> <%
} %>
<html> <head> <title>系统页面登陆</title> <META http-equiv=Content-Type content="text/html; charset=GBK"> <script language="JavaScript" src="calendar.js"></Script> <link href="images/server.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- body,td,th { font-size: 12px;} a {font-size: 12px;} .input_1 { BORDER-RIGHT: #c7c8c7 1px solid; BACKGROUND-POSITION: 50% top; BORDER-TOP: #c7c8c7 1px solid; FONT-SIZE: 12px; BACKGROUND-IMAGE: url(images/inputshow.gif); BORDER-LEFT: #c7c8c7 1px solid; COLOR: #7b7b7b; BORDER-BOTTOM: #c7c8c7 1px solid; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif } .style1 {color: #000000} --> </style> <script language="javascript"> 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; } </script> </head> <body background="images/index_17.gif" leftmargin="000" topmargin="0"><form name="dlym" method="POST" action="dlym.jsp" onSubmit="return checkInput();" > <table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/TYPE_BG.gif"> <tr> <td height=26></td></tr> </table> <br> <table align="center" border="1" cellspacing="0" style="border-collapse: collapse" bordercolor="#D6E6F0" cellpadding="6"> <tr><td colspan="2" background="IMAGES/bac.gif"><div align="center"><b> 登陆信息</b></div></td> </tr> <tr> <td width="69">用户名:</td> <td width="124"> <input name="uname" type="text" size="15" maxlength="15"> </td></tr> <tr> <td>密码:</td> <td width="124"> <input name="psw" type="password" size="15" maxlength="15" > </td></tr><tr> <td height="25" align="center" colspan="2" > <input type="submit" value="确定" name="Submit" > <input type="hidden" name="doCreate" value="true"> <input type="reset" value="取消" name="Submit2"> </td></tr> </table> <br></td></tr> </table> </form> </html>
- 一个简单的JSP登陆代码
- 一个最简单的会员登陆代码
- 一个最简单的会员登陆代码
- 一个简单的学生登陆系统的jsp实现之登陆主页面main.jsp
- jsp的综合练习,一个简单的登陆系统
- 一个简单的学生登陆系统的jsp实现_1
- 一个简单的登陆网页设计(JSP+MySQL+Tomcat)
- 一个简单的JSP分页代码
- 一个简单的学生登陆系统的jsp实现之登陆身份验证
- asp.net一个简单的登陆系统代码
- 练习代码,简单的登陆
- 一个简单的登陆控件
- 一个简单的struts登陆
- 一个简单的登陆界面
- 一个简单的登陆系统
- 一个简单的学生登陆系统的jsp实现之身份验证
- 一个简单的打印HttpServletRequest头jsp代码例子
- 简单的JSP用户登陆页面
- SWT or Swing?
- 当你离去后
- 7.9.2008
- 7.10.2008
- 将google加入到自己的网站中
- 一个简单的JSP登陆代码
- 使用 Eclipse Memory Analyzer 检测内存泄漏问题
- 7.11.2008
- 7.12.2008
- *_cast用法详解
- Mysql表
- 活动目录服务接口ADSI(Active Directory Service Interface)
- 利用Directsound编程实现实时混音
- oracle数据字典视图及其功能