首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

豁出去了,100分求求jsp+javabean+sqlserver登陆和注册代码~解决方案

2012-01-08 
豁出去了,100分求求jsp+javabean+sqlserver登陆和注册代码~~~一个简单的登陆代码就行了~~注册的稍微复杂点

豁出去了,100分求求jsp+javabean+sqlserver登陆和注册代码~~~
一个简单的登陆代码就行了~~
注册的稍微复杂点~~~
分不多~
靠大家帮忙了`~~
PS:数据库要sqlserver不要存储过程~~
所有的代码都要贴出来或发邮件给我~~
注册只要用户名、密码、地址、邮件(如果有插入自定义图像最好)~~
答案符合者可以追加分数~~

[解决办法]
UP
[解决办法]
这东西有点长了吧
[解决办法]
这么简单的东东还要?
[解决办法]
可惜我代码弄丢了,要不就能赚分了~
[解决办法]
我要,cqb816@yeah.net
[解决办法]
M_song()您好 能否把struts 2.0+spring+hibernate+mysql版的注册登录Demo 给我一份 学习一下 多谢 lianjiping@163.com
[解决办法]
懒得贴了,自己去网上找找吧,实在太多了
[解决办法]
发了一份给你 自己去看下
[解决办法]

<!--登录页 login.jsp-->
<%@ page contentType= "text/html; charset=GBK " %>
<html>
<head>
<title>
login
</title>
<script language= "JavaScript " type= " " src= "Login_yz.js ">
</script>
</head>
<body bgcolor= "#e8ffe8 ">
<center>
<h1>
用户登录
</h1>
<hr/>
<form name= "form_login " method= "POST " action= " "> <br /> <br />
<table width= "30% " border= "0 " bgcolor= "#ffe1f0 ">
<tr>
<td> &nbsp; </td>
<td> &nbsp; </td>
</tr>
<tr>
<td width= "40% "> <div align= "center "> 用户名: </div> </td>
<td width= "60% "> <input name= "user_name " type= "text " size= "15 " /> </td>
</tr>
<tr>
<td> <div align= "center "> 密&nbsp;&nbsp;码: </div> </td>
<td> <input name= "user_pwd " type= "password " size= "15 " /> </td>
</tr>
<tr>
<td colspan= "2 " align= "center ">
<%
String message = (String)session.getAttribute( "message ");
if(message == null) message = " ";
session.setAttribute( "message ",null);
%>
<font color= "red "> <%=message%> </font>
</td>
</tr>
<tr>
<td colspan= "2 "> <div align= "center "> <br/>
<input name= "sub " type= "submit " value= "登录 " onclick= "return fun(); "/> &nbsp;&nbsp;
<input name= "Reset " type= "reset " value= "重置 " /> &nbsp;&nbsp; <a href= "../manager/add/Regedit.jsp "> 注册 </a> </div>
<br/> </td>
</tr>
</table>
</form>
</center>


</body>
</html>
<!--用来验证的servlet-->
package servlet.login;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import bean.manager.Member_pwd_bean;
import bean.manager.Member_bean;
import database.Connection_Mssql2005;//用于连接数据库的类

public class Login_servlet extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK ";
public void init() throws ServletException {
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
response.setContentType(CONTENT_TYPE);
HttpSession session = request.getSession(true);
String user_name = new String(request.getParameter( "user_name ").getBytes( "ISO-8859-1 "), "gb2312 ");
String user_pwd = new String(request.getParameter( "user_pwd ").getBytes( "ISO-8859-1 "), "gb2312 ");
///////////////////////验证密码//////////////////////////////////
String sql_pwd = "select Member_pwd from Member where Member_name = ' " + user_name+ " ' ";
ArrayList list = new Connection_Mssql2005().getMember_all_list(sql_pwd);
Member_pwd_bean mpb = new Member_pwd_bean();
mpb = (Member_pwd_bean) list.get(0);

if (!mpb.getMember_pwd().equals(user_pwd))
session.setAttribute( "message ", "用户名或密码错误!! ");
response.sendRedirect( "../../login.jsp ");
}

public void destroy() {
}
}

<!--用于连接数据库的类-->

public class Connection_Mssql2005 {
static {
try {
String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver ";// MSSQl2005
Class.forName(driver);
} catch (Exception ex) {
ex.printStackTrace();
}
}

public Connection getConn() {

try {
Connection conn = null;
String url = "jdbc:sqlserver://localhost:1433;DataBaseName=你的数据库名 "; //sql2005
String user = "sa ";
String pwd = "123 ";
conn = DriverManager.getConnection(url, user, pwd); //
return conn;
} catch (Exception e) {
e.printStackTrace();
return null;
}

}

//返回会员表中的用户信息
public ArrayList getMember_all_list(String sql) {
ArrayList list = new ArrayList();
try {
Connection conn = new Connection_Mssql2005().getConn();
PreparedStatement prepStmt = conn.prepareStatement(sql);
ResultSet rs = prepStmt.executeQuery();
while (rs.next()) {
Member_bean mb = new Member_bean();
mb.setMember_id(rs.getInt( "Member_id "));
mb.setMember_name(rs.getString( "Member_name "));
mb.setMember_pwd(rs.getString( "Member_pwd "));
list.add(mb);
}
rs.close();
prepStmt.close();
conn.close();
} catch (Exception ex) {
ex.printStackTrace();
}
return list;
}

}

<!---->
package bean.manager;

public class Member_bean {
private int member_id;
private String member_name;
private String member_pwd;

public int getMember_id() {


return member_id;
}

public String getMember_name() {
return member_name;
}

public String getMember_pwd() {
return member_pwd;
}

public void setMember_id(int member_id) {
this.member_id = member_id;
}

public void setMember_name(String member_name) {
this.member_name = member_name;
}

public void setMember_pwd(String member_pwd) {
this.member_pwd = member_pwd;
}

}
[解决办法]
M_song()
struts 2.0+spring+hibernate+mysql版的注册登录Demo
发一份我看看吧

snps001@163.com
[解决办法]
每个教师最先讲的就是登陆注册....哞..简单
[解决办法]
正好我也在学,好心也给我一份DEMO吧。

netbyer@163.com
[解决办法]

M_song()
struts 2.0+spring+hibernate+mysql版的注册登录Demo
发一份我看看吧

我也要

vcuser@163.com

谢谢
[解决办法]
分数有屁用啊,我送你100分吧
[解决办法]
尊敬的LZ您上次 好象发过一个类似的帖子吧 你不留个EMAIL之类的怎么给你 那东西怎么说也得个几百行吧 给你留我EMAIL你发信了吗????(不好意思我邮箱信太多有的不看就删了 您在主题里面 写清楚写哦 )
[解决办法]
up
[解决办法]
谢谢啦
malian_he@126.com
[解决办法]
晕,国产程序员的水平呀~
[解决办法]
struts 2.0+spring+hibernate+mysql版的注册登录 我也想要
lidaxuanshuai@sina.com
[解决办法]
M_song()您好 能否把struts 2.0+spring+hibernate+mysql版的注册登录Demo 给我一份 学习一下 多谢 xaq84@163.com
[解决办法]
这个应该是最基本的吧..- -#
帮顶下勒
[解决办法]
学习下.
[解决办法]
这个的确够基本的
[解决办法]
这个上网一找大把。。。
[解决办法]
M_song()把Demo也发个俺吧,谢谢
jefy_jiang@yahoo.com.cn
[解决办法]
<%@ page contentType= "text/html;charset=gb2312 " %>
<script language= "javascript ">
function newObject(url) {
//产生ajax的客户端对象
if(window.XMLHttpRequest) {//如果是Mozilaa的浏览器
req = new XMLHttpRequest() ;
}else if(window.ActiveXObject) {//如果是IE
req = new ActiveXObject( "Microsoft.XMLHttp ") ;
}

//设置对象的属性
req.onreadystatechange=processMessage ;//当状态改变是,触发什么函数
req.open( "GET " , url , true) ;//指定传输方式,和接收什么后台程序发送来的信息
req.send(null) ;//GET方式特有的,需要先发送一个null
}

function processMessage() {
if(req.readystate==4) {//4就是正常
if(req.status==200) {
alert(req.responseText) ;
//valiU.innerHTML=req.responseText ;
var xmlDoc = new ActiveXObject( "Microsoft.XMLDOM ")


xmlDoc.async= "false "
xmlDoc.validateOnParse= "true "
xmlDoc.load(req.responseText) ;
//var nodes = xmlDoc.documentElement.childNodes
//alert(nodes.item(0).text) ;
alert(xmlDoc.childNodes.text) ;
}
}else{
//0是未初始化
//1是读取中
//2是已读取
//3是交换中
}
}
function valiUsername(username) {
if(username== ' ') {
valiU.innerHTML= "请输入用户名 " ;
}else {
newObject( "valiU.jsp?username= "+username) ;
}
}
</script>
<form action= "regc.jsp ">
用户名: <input type= "text " name= "username " onBlur= "valiUsername(this.value) ">
<div id= "valiU " style= "color:#FF0000 "> </div>
密码: <input type= "password " name= "password "> <br>
重新输入密码: <input type= "password " name= "rpassword "> <br>
<input type= "submit " value= "注册 ">
</form>

<% session.removeAttribute( "mess ") ; %>
[解决办法]
楼上的ajax?
没写卍
[解决办法]
M_song()
struts 2.0+spring+hibernate+mysql版的注册登录Demo
发一份我看看吧
我正在学这个 谢谢你拉
fanhuan11111@163.com

热点排行