取值(50分)

  • 主题发起人 主题发起人 weicheng
  • 开始时间 开始时间
W

weicheng

Unregistered / Unconfirmed
GUEST, unregistred user!
我连接的是SQL数据库
change.jsp

<%@ page contentType=&quot;text/html;charset=gb2312&quot;
%>
<%@ page import=&quot;java.lang.*&quot;%>
<%@ include file=&quot;config.jsp&quot;%>
<%
String username= session.getAttribute(&quot;username&quot;);
String sqlout=&quot;select * from userlist where username='&quot;+username+&quot;'&quot;;
ResultSet rs = stmt.executeQuery(sqlout);
if(rs.next())
{
session.setAttribute(&quot;CiceName&quot;, CiceName);
session.setAttribute(&quot;CiceNo&quot;, CiceNo);
}
%>
<html>
<head>
<meta http-equiv=&quot;Content-Language&quot;
content=&quot;zh-cn&quot;>
<meta http-equiv=&quot;Content-Type&quot;
content=&quot;text/html;
charset=gb2312&quot;>
<title>用户资料修改</title>
</head>
<body bgcolor=#B9DFDD>
<table border=&quot;0&quot;
cellpadding=&quot;0&quot;
cellspacing=&quot;0&quot;
width=&quot;800&quot;
height=&quot;281&quot;>
<!-- MSTableType=&quot;layout&quot;
-->
<tr>
<td valign=&quot;top&quot;
colspan=&quot;2&quot;
height=&quot;39&quot;>
<!-- MSCellType=&quot;ContentHead&quot;
-->
 </td>
</tr>
<tr>
<td msopnltype=&quot;NavBody&quot;
rowspan=&quot;2&quot;
width=&quot;138&quot;>
<!-- MSCellType=&quot;NavBody&quot;
-->
 </td>
<td valign=&quot;top&quot;
height=&quot;217&quot;>
<!-- MSCellType=&quot;ContentBody&quot;
-->
<div style=&quot;position: absolute;
width: 394px;
height: 206px;
z-index: 1;
left: 228px;
top: 57px&quot;
id=&quot;layer1&quot;>
<form name=&quot;infochange&quot;
method=&quot;POST&quot;
action=&quot;changeinfo1ok.jsp&quot;>

<span style=&quot;font-size: 14.0pt;
font-family: 宋体&quot;>带 团 导 游 姓 名:</span>
<%=session.getAttribute(&quot;CiceName&quot;)%>
<span style=&quot;font-size: 14.0pt;
font-family: 宋体&quot;> <br>

团 导 游 证 号: </span><%=session.getAttribute(&quot;CiceNo&quot;)%>
<span style=&quot;font-size: 14.0pt;
font-family: 宋体&quot;><br>
带 团 导 游 电 话:</span>
<input type=&quot;text&quot;
name=&quot;T2&quot;
size=&quot;20&quot;
value=<%=session.getAttribute(&quot;CicePhone&quot;)%>><font color=&quot;#FF0000&quot;> *</font>

<p align=center>
(<font color=&quot;#FF0000&quot;>*</font>) 号必填<br>
<input onClick=&quot;return check();&quot;
type=&quot;submit&quot;
value=&quot;提交&quot;
name=&quot;submit&quot;>
<input type=&quot;reset&quot;
value=&quot;重置&quot;
name=&quot;B2&quot;></p>
</form>
</div>
<p> </td>
</tr>
<tr>
<td valign=&quot;top&quot;
height=&quot;25&quot;
width=&quot;662&quot;>
<!-- MSCellType=&quot;ContentFoot&quot;
-->
 </td>
</tr>
</table>
</body>
</html>
<script LANGUAGE=&quot;javascript&quot;>
<!--
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(&quot;带团导游电话不能为空!&quot;);
return false;
}
document.infochange.submit();
}
//-->
</script>
<%
stmt.close();
rs.close();
conn.close();
%>

changeinfo1ok.jsp

<%@ page language=&quot;java&quot;
contentType=&quot;text/html;
charset=GBK&quot;
%>
<%@ include file=&quot;config.jsp&quot;%>
<%
String idname = session.getAttribute(&quot;username&quot;);

String sqlout=&quot;select * from userlist where username='&quot;+idname+&quot;'&quot;;

ResultSet rs = stmt.executeQuery(sqlout);

if(rs.next())

{
session.setAttribute(&quot;CiceName&quot;,CiceName);

session.setAttribute(&quot;CiceNo&quot;,CiceNo);

session.setAttribute(&quot;CicePhone&quot;,CicePhone);

String CicePhone= session.getAttribute(&quot;CicePhone&quot;);

String sqlup=&quot;update userlist set CicePhone='&quot;+T2+&quot;'where CicePhone='&quot;+CicePhone+&quot;' &quot;;
rs=stmt.executeQuery(sqlup);
response.sendRedirect(&quot;true.htm&quot;);
}
else
{
response.sendRedirect(&quot;error.htm&quot;);
}
stmt.close();//关闭记录集
rs.close();///关闭preparedstatement
conn.close();//关闭连接
%>

想问下 我上面哪里写错了,要怎么改才能修改资料
 
是不是发错地方了,
老哥?
 
已经解决了
 
解决问题了
 
解决了就散分啊!
 

Similar threads

I
回复
0
查看
3K
import
I
I
回复
0
查看
2K
import
I
I
回复
0
查看
672
import
I
I
回复
0
查看
1K
import
I
I
回复
0
查看
3K
import
I
后退
顶部