W
weicheng
Unregistered / Unconfirmed
GUEST, unregistred user!
我连接的是SQL数据库
change.jsp
<%@ page contentType="text/html;charset=gb2312"
%>
<%@ page import="java.lang.*"%>
<%@ include file="config.jsp"%>
<%
String username= session.getAttribute("username"
String sqlout="select * from userlist where username='"+username+"'";
ResultSet rs = stmt.executeQuery(sqlout);
if(rs.next())
{
session.setAttribute("CiceName", CiceName);
session.setAttribute("CiceNo", CiceNo);
}
%>
<html>
<head>
<meta http-equiv="Content-Language"
content="zh-cn">
<meta http-equiv="Content-Type"
content="text/html;
charset=gb2312">
<title>用户资料修改</title>
</head>
<body bgcolor=#B9DFDD>
<table border="0"
cellpadding="0"
cellspacing="0"
width="800"
height="281">
<!-- MSTableType="layout"
-->
<tr>
<td valign="top"
colspan="2"
height="39">
<!-- MSCellType="ContentHead"
-->
</td>
</tr>
<tr>
<td msopnltype="NavBody"
rowspan="2"
width="138">
<!-- MSCellType="NavBody"
-->
</td>
<td valign="top"
height="217">
<!-- MSCellType="ContentBody"
-->
<div style="position: absolute;
width: 394px;
height: 206px;
z-index: 1;
left: 228px;
top: 57px"
id="layer1">
<form name="infochange"
method="POST"
action="changeinfo1ok.jsp">
<span style="font-size: 14.0pt;
font-family: 宋体">带 团 导 游 姓 名:</span>
<%=session.getAttribute("CiceName"%>
<span style="font-size: 14.0pt;
font-family: 宋体"> <br>
带
团 导 游 证 号: </span><%=session.getAttribute("CiceNo"%>
<span style="font-size: 14.0pt;
font-family: 宋体"><br>
带 团 导 游 电 话:</span>
<input type="text"
name="T2"
size="20"
value=<%=session.getAttribute("CicePhone"%>><font color="#FF0000"> *</font>
<p align=center>
(<font color="#FF0000">*</font>) 号必填<br>
<input onClick="return check();"
type="submit"
value="提交"
name="submit">
<input type="reset"
value="重置"
name="B2"></p>
</form>
</div>
<p> </td>
</tr>
<tr>
<td valign="top"
height="25"
width="662">
<!-- MSCellType="ContentFoot"
-->
</td>
</tr>
</table>
</body>
</html>
<script LANGUAGE="javascript">
<!--
function checkspace(checkstr) {
var str = '';
for(i = 0;
i < checkstr.length;
i++) {
str = str + ' ';
}
return (str == checkstr);
}
function check()
{
if(checkspace(document.infochange.T2.value)) {
document.infochange.T2.focus();
alert("带团导游电话不能为空!"
return false;
}
document.infochange.submit();
}
//-->
</script>
<%
stmt.close();
rs.close();
conn.close();
%>
changeinfo1ok.jsp
<%@ page language="java"
contentType="text/html;
charset=GBK"
%>
<%@ include file="config.jsp"%>
<%
String idname = session.getAttribute("username"
String sqlout="select * from userlist where username='"+idname+"'";
ResultSet rs = stmt.executeQuery(sqlout);
if(rs.next())
{
session.setAttribute("CiceName",CiceName);
session.setAttribute("CiceNo",CiceNo);
session.setAttribute("CicePhone",CicePhone);
String CicePhone= session.getAttribute("CicePhone"
String sqlup="update userlist set CicePhone='"+T2+"'where CicePhone='"+CicePhone+"' ";
rs=stmt.executeQuery(sqlup);
response.sendRedirect("true.htm"
}
else
{
response.sendRedirect("error.htm"
}
stmt.close();//关闭记录集
rs.close();///关闭preparedstatement
conn.close();//关闭连接
%>
想问下 我上面哪里写错了,要怎么改才能修改资料
change.jsp
<%@ page contentType="text/html;charset=gb2312"
%>
<%@ page import="java.lang.*"%>
<%@ include file="config.jsp"%>
<%
String username= session.getAttribute("username"
String sqlout="select * from userlist where username='"+username+"'";
ResultSet rs = stmt.executeQuery(sqlout);
if(rs.next())
{
session.setAttribute("CiceName", CiceName);
session.setAttribute("CiceNo", CiceNo);
}
%>
<html>
<head>
<meta http-equiv="Content-Language"
content="zh-cn">
<meta http-equiv="Content-Type"
content="text/html;
charset=gb2312">
<title>用户资料修改</title>
</head>
<body bgcolor=#B9DFDD>
<table border="0"
cellpadding="0"
cellspacing="0"
width="800"
height="281">
<!-- MSTableType="layout"
-->
<tr>
<td valign="top"
colspan="2"
height="39">
<!-- MSCellType="ContentHead"
-->
</td>
</tr>
<tr>
<td msopnltype="NavBody"
rowspan="2"
width="138">
<!-- MSCellType="NavBody"
-->
</td>
<td valign="top"
height="217">
<!-- MSCellType="ContentBody"
-->
<div style="position: absolute;
width: 394px;
height: 206px;
z-index: 1;
left: 228px;
top: 57px"
id="layer1">
<form name="infochange"
method="POST"
action="changeinfo1ok.jsp">
<span style="font-size: 14.0pt;
font-family: 宋体">带 团 导 游 姓 名:</span>
<%=session.getAttribute("CiceName"%>
<span style="font-size: 14.0pt;
font-family: 宋体"> <br>
带
团 导 游 证 号: </span><%=session.getAttribute("CiceNo"%>
<span style="font-size: 14.0pt;
font-family: 宋体"><br>
带 团 导 游 电 话:</span>
<input type="text"
name="T2"
size="20"
value=<%=session.getAttribute("CicePhone"%>><font color="#FF0000"> *</font>
<p align=center>
(<font color="#FF0000">*</font>) 号必填<br>
<input onClick="return check();"
type="submit"
value="提交"
name="submit">
<input type="reset"
value="重置"
name="B2"></p>
</form>
</div>
<p> </td>
</tr>
<tr>
<td valign="top"
height="25"
width="662">
<!-- MSCellType="ContentFoot"
-->
</td>
</tr>
</table>
</body>
</html>
<script LANGUAGE="javascript">
<!--
function checkspace(checkstr) {
var str = '';
for(i = 0;
i < checkstr.length;
i++) {
str = str + ' ';
}
return (str == checkstr);
}
function check()
{
if(checkspace(document.infochange.T2.value)) {
document.infochange.T2.focus();
alert("带团导游电话不能为空!"
return false;
}
document.infochange.submit();
}
//-->
</script>
<%
stmt.close();
rs.close();
conn.close();
%>
changeinfo1ok.jsp
<%@ page language="java"
contentType="text/html;
charset=GBK"
%>
<%@ include file="config.jsp"%>
<%
String idname = session.getAttribute("username"
String sqlout="select * from userlist where username='"+idname+"'";
ResultSet rs = stmt.executeQuery(sqlout);
if(rs.next())
{
session.setAttribute("CiceName",CiceName);
session.setAttribute("CiceNo",CiceNo);
session.setAttribute("CicePhone",CicePhone);
String CicePhone= session.getAttribute("CicePhone"
String sqlup="update userlist set CicePhone='"+T2+"'where CicePhone='"+CicePhone+"' ";
rs=stmt.executeQuery(sqlup);
response.sendRedirect("true.htm"
}
else
{
response.sendRedirect("error.htm"
}
stmt.close();//关闭记录集
rs.close();///关闭preparedstatement
conn.close();//关闭连接
%>
想问下 我上面哪里写错了,要怎么改才能修改资料