求助:JSP网页注册程序里少了一段连接到数据库保存的代码,所以老是登陆失败,求高人指点怎么添加
原代码如下:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ taglib uri="/struts-bean" prefix="bean" %>
<%@ taglib uri="/struts-html" prefix="html" %>
<jsp:useBean id="JSONRPCBridge" scope="session" class="com.metaparadigm.jsonrpc.JSONRPCBridge"/>
<jsp:useBean id="ajax" class="com.base.AjaxBean"></jsp:useBean>
<%
JSONRPCBridge.registerObject("ajax",ajax);
%>
<html>
<head>
<title><bean:message key="website.title"/></title>
<link href="CSS/stylesheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="JS/jsonrpc.js"></script>
<style type="text/css">
<!--
.STYLE1 {
color: #FF9900;
font-weight: bold;
font-size: small;
}
.STYLE2 {
color: #FF9900;
font-weight: bold;
font-size: 40px;
}
.STYLE3 {font-size: 25px}
.STYLE4 {font-family: "华文彩云"}
-->
</style>
</head>
<body class="body">
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border:1px; border-style:solid; border-color:#888888">
<tr>
<td width="20"> </td>
<TD width="400" height="50" align="right" valign="bottom"><div align="justify" class="STYLE2"><span class="STYLE4">吉之岛</span><span class="STYLE3">电子商城</span></div></TD>
<TD width="337" height="50" align="right" valign="bottom"><INPUT id="qKey" name="qKey" value="商品关键字" onClick="this.value=''">
<SELECT id="category" name="category">
<option value="0">所有商品</option>
</SELECT>
<A href="javascript:QuickSearch()"><IMG src="images/icon_search.jpg" width="39" height="19" border="0" align="absMiddle"></A></TD>
<td width="20"> </td>
</tr>
<tr>
<td> </td>
<td colspan="2">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
</TABLE></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2">
<html:javascript formName="memberForm"/>
<html:form action="/mem.do?method=reg" style="margin:0px;" onsubmit="return validateMemberForm(this);">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td height="30" class="header_menu">
<A href="mer.do?method=browseIndexMer"><span class="blackTitle"><bean:message key="menu.item1"/></span></A>
</td>
<td height="80" colspan="2" rowspan="3" align="center"><IMG src="images/icon_reg.jpg" width="108" height="37"></td>
</tr>
<tr>
<td height="30" class="header_menu">
<A href="cart.do?method=browseCart"><span class="blackTitle"><bean:message key="menu.item2"/></span></A>
</td>
</tr>
<tr>
<td height="30" class="header_menu">
<A href="order.do?method=browseOrder"><span class="blackTitle"><bean:message key="menu.item3"/></span></A> </td>
</tr>
<tr>
<td width="160" height="30" class="header_menu">
<A href="mem.do?method=browseWord"><span class="blackTitle">
<bean:message key="menu.item4"/></span></A>
</td>
<td width="117" height="26" class="text" align="right"><bean:message key="member.realname"/>:</td>
<td width="456"><html:text property="memberName" size="30" styleClass="textBox"/></td>
</tr>
<tr>
<td width="160" height="30" class="header_menu">
<A href="mem.do?method=loadMember"><span class="blackTitle">
<bean:message key="menu.item5"/></span></A>
</td>
<td height="26" class="text" align="right"><bean:message key="member.login.name"/>:</td>
<td height="26"><html:text property="loginName" size="30" styleClass="textBox" onblur="checkLoginName()"/></td>
</tr>
<tr>
<td width="160" height="30" ></td>
<td height="26" class="text" align="right"><bean:message key="member.login.pwd"/>:</td>
<td height="26"><html:password property="loginPwd" size="30" styleClass="textBox"/></td>
</tr>
<tr>
<td width="160" height="30" ></td>
<td height="26" class="text" align="right"><bean:message key="member.login.repwd"/>:</td>
<td height="26"><input type="password" id="reLoginPwd" size="30" class="textBox" onBlur="checkPwd()"/></td>
</tr>
<tr>
<td width="160" height="30" ></td>
<td height="26" class="text" align="right"><bean:message key="member.phone"/>:</td>
<td height="26"><html:text property="phone" size="30" styleClass="textBox"/></td>
</tr>
<tr>
<td width="160" height="30" ></td>
<td height="26" class="text" align="right"><bean:message key="member.address"/>:</td>
<td height="26"><html:text property="address" size="30" styleClass="textBox"/></td>
</tr>
<tr>
<td width="160" height="30" ></td>
<td height="26" class="text" align="right"><bean:message key="member.zip"/>:</td>
<td height="26"><html:text property="zip" size="30" styleClass="textBox"/></td>
</tr>
<tr>
<td width="160" height="30" ></td>
<td height="26" class="text" align="right"><bean:message key="member.email"/>:</td>
<td height="26"><html:text property="email" size="30" styleClass="textBox"/></td>
</tr>
<tr>
<td height="40" colspan="3" align="center">
<html:submit property="C_Input" styleClass="C_Input">
<bean:message key="member.reg.text"/>
</html:submit><br>
<span class="redText"><html:errors property="addMemStatus"/></span> </td>
</tr>
</table>
</html:form> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td height="30" colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td height="20" colspan="2"><div align="right"><span class="STYLE1">方济清设计</span></div></td>
<td> </td>
</tr>
</table>
<script language="javascript">
//构造商品分类下拉列表
jsonrpc = new JSONRpcClient("JSON-RPC");
var result = jsonrpc.ajax.getCategory();
for (var i=0;i<result.length;i++){
option =document.createElement("OPTION");
option.value = result[i][0];
option.text = result[i][1];
document.all.category.options.add(option);
}
//构造会员级别下拉列表
result = jsonrpc.ajax.getMemberLevel();
for (var i=0;i<result.length;i++){
option =document.createElement("OPTION");
option.value = result[i][0];
option.text = result[i][1];
document.all.memberlevel.options.add(option);
}
//密码核对
function checkPwd(){
if (document.all.loginPwd.value != document.all.reLoginPwd.value){
alert('对不起,两次输入的密码不一致,请重新输入!');
document.all.loginPwd.value = "";
document.all.reLoginPwd.value ="";
document.all.loginPwd.focus();
}
}
//登录帐号有效性检查
function checkLoginName(){
var lname = document.all.loginName.value;
if ((lname !=null)&&(lname.length>0)&&(!jsonrpc.ajax.chkLoginName(lname))){
alert('对不起,该登录帐号已被占用,请重新输入!');
document.all.loginName.focus();
}
}
//搜索商品
function QuickSearch(){
var url = "mer.do?method=searchMer&cateid="+document.all.category.value;
var key = document.all.qKey.value;
if (key !=null && key!="商品关键字" && key.length>0)url = url+"&key="+key;
window.location = url;
}
</script>
</body>
</html>
数据库名字为db_eshop,保存在member表里