⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userinfo.jsp

📁 java + sqlserver2000编写的一个网上购书系统,实现了一些基本的功能,但对于初学者来说这个系统已经足以起到帮助作用
💻 JSP
字号:
<%@ page contentType="text/html;charset=gbk"%>
<%@ page import="java.sql.*"%>
<jsp:useBean id="databean" scope="session" class="ConnBean.conn" />

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
		<LINK href="../images/style.css" type=text/css rel=stylesheet>
		<title>我的半岛</title>

		<style type="text/css">
.style1 {
	color: #4F7FC7
}

.STYLE2 {
	font-size: 14px;
	color: #020986;
}

.STYLE3 {
	color: #E30072
}

#tablist {
	padding: 3px 0;
	margin-left: 0;
	margin-bottom: 0;
	margin-top: 0.1em;
	font: bold 12px Verdana;
}

#tablist li {
	list-style: none;
	display: inline;
	margin: 0;
}

#tablist li a {
	padding: 3px 0.5em;
	margin-left: 3px;
	border: 1px solid #778;
	border-bottom: none;
	background: white;
}

#tablist li a:link,#tablist li a:visited {
	color: navy;
}

#tablist li a.current {
	background: lightyellow;
}

#tabcontentcontainer {
	width: 400px;
	/* Insert Optional Height definition here to give all the content a unified height */
	padding: 5px;
	border: 1px solid black;
	align: center;
}

.tabcontent {
	display: none;
}
</style>

		<script type="text/javascript">

var initialtab=[1, "sc1"]

////////Stop editting////////////////

function cascadedstyle(el, cssproperty, csspropertyNS){
if (el.currentStyle)
return el.currentStyle[cssproperty]
else if (window.getComputedStyle){
var elstyle=window.getComputedStyle(el, "")
return elstyle.getPropertyValue(csspropertyNS)
}
}

var previoustab=""

function expandcontent(cid, aobject){
if (document.getElementById){
highlighttab(aobject)
if (previoustab!="")
document.getElementById(previoustab).style.display="none"
document.getElementById(cid).style.display="block"
previoustab=cid
if (aobject.blur)
aobject.blur()
return false
}
else
return true
}

function highlighttab(aobject){
if (typeof tabobjlinks=="undefined")
collecttablinks()
for (i=0; i<tabobjlinks.length; i++)
tabobjlinks[i].style.backgroundColor=initTabcolor
var themecolor=aobject.getAttribute("theme")? aobject.getAttribute("theme") : initTabpostcolor
aobject.style.backgroundColor=document.getElementById("tabcontentcontainer").style.backgroundColor=themecolor
}

function collecttablinks(){
var tabobj=document.getElementById("tablist")
tabobjlinks=tabobj.getElementsByTagName("A")
}

function do_onload(){
collecttablinks()
initTabcolor=cascadedstyle(tabobjlinks[1], "backgroundColor", "background-color")
initTabpostcolor=cascadedstyle(tabobjlinks[0], "backgroundColor", "background-color")
expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload


</script>
	</head>

	<body>
<TABLE width=760 border=0 align="center" cellPadding=0 cellspacing="0"
			bgcolor="#FFFFFF" style="BORDER-COLLAPSE: collapse">
			<jsp:include page="top_mybandao.jsp" />
		</table>
		
		<%
			while (session.getAttribute("user") == null) {
				out
						.print("<script language=\"JavaScript\">alert(\"登陆后再操作!\");location.href=\"../index.jsp\"</script>");
			}
		%>
		<div align="center">
			<ul id="tablist">
				<li>
					<a href="#" class="current"
						onClick="return expandcontent('sc1', this)"> 用户信息 </a>
				</li>
				<li>
					<a href="new.htm" onClick="return expandcontent('sc2', this)"
						theme="#EAEAFF"> 修改信息 </a>
				</li>
				<li>
					<a href="hot.htm" onClick="return expandcontent('sc3', this)"
						theme="#FFE6E6"> 修改密码 </a>
				</li>
			</ul>

			<DIV id="tabcontentcontainer">
				<div id="sc1" class="tabcontent">
					<%
						String userName = (String) session.getAttribute("user");
						ResultSet rset = null;

						//if (session.getAttribute("user") == null) {
						//out
						//		.print("<script language=\"JavaScript\">alert(\"请先登陆!\");location.href=\"../index.jsp\"</script>");
						//} else {
						try {
							String sql = "select * from userinfo where UserName='"
									+ userName + "'";
							rset = databean.executeQuery(sql);

							if (rset.next()) {
								String username = rset.getString("UserName");
								String rname = rset.getString("RealName");
								String sex = rset.getString("Sex");
								String telephone = rset.getString("Telephone");
								String address = rset.getString("Address");
								String post = rset.getString("Post");
								String email = rset.getString("Email");
								String regtime = rset.getString("RegTime");
								String birthday = rset.getString("BirthDay");
								String educate = rset.getString("Educate");
					%>
					<TABLE align="center"
						style="BORDER-RIGHT: #4f7fc7 1px solid; BORDER-TOP: #4f7fc7 1px solid; BORDER-LEFT: #4f7fc7 1px solid; BORDER-BOTTOM: #4f7fc7 1px solid; BORDER-COLLAPSE: collapse"
						cellPadding=3 width="296" height="288" border="1">
						<tr>
							<td>
								用&nbsp;户&nbsp;名:&nbsp;&nbsp;&nbsp;&nbsp;
								<%
									out.print(username);
								%>
							</td>
						</tr>
						<tr>
							<td>
								姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:&nbsp;&nbsp;&nbsp;&nbsp;
								<%
									out.print(rname);
								%>
							</td>
						</tr>
						<tr>
							<td>
								性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:&nbsp;&nbsp;&nbsp;&nbsp;
								<%
									out.print(sex);
								%>
							</td>
						</tr>
						<tr>
							<td>
								电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话:&nbsp;&nbsp;&nbsp;&nbsp;
								<%
									out.print(telephone);
								%>
							</td>
						</tr>
						<tr>
							<td>
								地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址:&nbsp;&nbsp;&nbsp;&nbsp;
								<%
									out.print(address);
								%>
							</td>
						</tr>
						<tr>
							<td>
								邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编:&nbsp;&nbsp;&nbsp;&nbsp;
								<%
									out.print(post);
								%>
							</td>
						</tr>
						<tr>
							<td>
								&nbsp;&nbsp;&nbsp;Email:&nbsp;&nbsp;&nbsp;&nbsp;
								<%
									out.print(email);
								%>
							</td>
						</tr>
						<tr>
							<td>
								注册时间:&nbsp;&nbsp;&nbsp;&nbsp;
								<%
									out.print(regtime);
								%>
							</td>
						</tr>
						<tr>
							<td>
								生&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;日:&nbsp;&nbsp;&nbsp;&nbsp;
								<%
									out.print(birthday);
								%>
							</td>
						</tr>
						<tr>
							<td>
								教育程度:&nbsp;&nbsp;&nbsp;&nbsp;
								<%
									out.print(educate);
								%>
							</td>
						</tr>
					</table>

					<%
						} else {
							}
						} catch (SQLException e) {
							e.printStackTrace();
						}
						//}
					%>
					<div align="center">
						<TABLE style="BORDER-COLLAPSE: collapse" cellPadding=0 width=100
							border=0>
							<TBODY>
								<TR>
									<TD height=40></TD>
								</TR>
							</TBODY>
						</TABLE>
					</div>
				</div>

				<div id="sc2" class="tabcontent">
					<form action="userupdate.jsp" method="post" align="center">

						<TABLE align="center"
							style="BORDER-RIGHT: #4f7fc7 1px solid; BORDER-TOP: #4f7fc7 1px solid; BORDER-LEFT: #4f7fc7 1px solid; BORDER-BOTTOM: #4f7fc7 1px solid; BORDER-COLLAPSE: collapse"
							cellPadding=3 width="296" height="288" border="1">
							<tr>
								<td>
									用户名:
									<%
									out.print(rset.getString("UserName"));
								%>
								</td>
							</tr>
							<tr>
								<td>
									姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:

									<input name="realname" type="text" id="rname"
										style="width: 120px; color: #000000; border: 1px solid #CFCFCF; background-color: #ffffff"
										value=<%out.print(rset.getString("RealName"));%>>
								</td>
							</tr>
							<tr>
								<td>

									<label>
										性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:
										<select name="sex">
											<option value="男">
											</option>
											<option value="女">
											</option>
										</select>
									</label>
								</td>
							</tr>
							<tr>
								<td>
									电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话:

									<input name="telephone" type="text" id="telephone"
										style="width: 120px; color: #000000; border: 1px solid #CFCFCF; background-color: #ffffff"
										value=<%out.print(rset.getString("Telephone"));%>>
								</td>
							</tr>
							<tr>
								<td>
									地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址:
									<input name="address" type="text" id="password"
										style="width: 120px; color: #000000; border: 1px solid #CFCFCF; background-color: #ffffff"
										value=<%out.print(rset.getString("Address"));%>>
								</td>
							</tr>
							<tr>
								<td>
									邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编:
									<input name="post" type="text" id="b"
										style="width: 120px; color: #000000; border: 1px solid #CFCFCF; background-color: #ffffff"
										value=<%out.print(rset.getString("Post"));%>>
								</td>
							</tr>
							<tr>
								<td>
									&nbsp;&nbsp;&nbsp;Email:
									<input name="email" type="text" id="b"
										style="width: 120px; color: #000000; border: 1px solid #CFCFCF; background-color: #ffffff"
										value=<%out.print(rset.getString("Email"));%>>
								</td>
							</tr>
							<tr>
								<td>
									注册时间:
									<%
									out.print(rset.getString("RegTime"));
								%>
								</td>
							</tr>
							<tr>
								<td>
									生&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;日:
									<input name="birthday" type="text" id="b"
										style="width: 120px; color: #000000; border: 1px solid #CFCFCF; background-color: #ffffff"
										value=<%out.print(rset.getString("BirthDay"));%>>
								</td>
							</tr>
							<tr>
								<td>

									<label>
										教育程度:
										<select name="educate">
											<option value="小学">
												小学
											</option>
											<option value="初中">
												初中
											</option>
											<option value="高中">
												高中
											</option>
											<option value="大学本科">
												大学本科
											</option>
											<option value="本科以上学历">
												本科以上学历
											</option>
										</select>
									</label>
								</td>
							</tr>
						</table>

						<div align="center">
							<input name="submit" type="submit" value="修改">
							<input name="button" type="button" value="退出" align="middle"
								onClick="javascript:location.href='mybandao.jsp';">
						</div>
					</form>
				</div>

				<div id="sc3" class="tabcontent">
					<form action="userupdatePWD.jsp" method="post" align="center">
						<TABLE align="center"
							style="BORDER-RIGHT: #4f7fc7 1px solid; BORDER-TOP: #4f7fc7 1px solid; BORDER-LEFT: #4f7fc7 1px solid; BORDER-BOTTOM: #4f7fc7 1px solid; BORDER-COLLAPSE: collapse"
							cellPadding=3 width="296" height="288" border="1">
							<tr>
								<td>
									用户名:
									<%
									out.print(session.getAttribute("user"));
								%>
								</td>
							</tr>

							<tr>
								<td>
									原&nbsp;密&nbsp;码:

									<input name="password" type="password" id="pwd"
										style="width: 120px; color: #000000; border: 1px solid #CFCFCF; background-color: #ffffff">
								</td>
							</tr>
							<tr>
								<td>
									新&nbsp;密&nbsp;码:
									<input name="password1" type="password" id="pwd1"
										style="width: 120px; color: #000000; border: 1px solid #CFCFCF; background-color: #ffffff">
								</td>
							</tr>
							<tr>
								<td>
									确认密码:
									<input name="password2" type="password" id="pwd2"
										style="width: 120px; color: #000000; border: 1px solid #CFCFCF; background-color: #ffffff">
								</td>
							</tr>
						</table>


						<div align="center">
							<input name="submit" type="submit" value="修改">
							<input name="button" type="button" value="退出" align="absmiddle"
								onClick="javascript:location.href='mybandao.jsp';">
						</div>
					</form>
				</div>
			</DIV>
		</div>

		<TABLE style="BORDER-COLLAPSE: collapse" cellPadding=0 width=100
			border=0>
			<TBODY>
				<TR>
					<TD height=50></TD>
				</TR>
			</TBODY>
		</TABLE>

		<table align="center" valign="top" height="130">
			<jsp:include page="../bottom.jsp" />
		</table>
	</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -