edit_infor.jsp
来自「这是一个用Struts+Hibernate+Tomcat5.5.9实现的一个“课」· JSP 代码 · 共 168 行
JSP
168 行
<%@page contentType="text/html; charset=gb2312" language="java" errorPage="errorpage.jsp"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="hibernate.HibernateUtil"%>
<%@ page import="hibernate.Student"%>
<%@ page import="hibernate.Teacher"%>
<html><!-- InstanceBegin template="/Templates/student.dwt.jsp" codeOutsideHTMLIsLocked="false" -->
<!-- DW6 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!-- InstanceBeginEditable name="doctitle" -->
<title>修改信息</title>
<!-- InstanceEndEditable --><link rel="stylesheet" href="2col_leftNav.css" type="text/css">
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.style1 {font-size: 14px}
-->
</style>
<!-- InstanceEndEditable -->
</head>
<!-- The structure of this file is exactly the same as 2col_rightNav.html;
the only difference between the two is the stylesheet they use -->
<body>
<%
String username = (String) session.getAttribute("username");
if(username==null){response.sendRedirect("index.jsp");}
%>
<div id="masthead">
<h1 id="siteName"> </h1>
<div id="globalNav">
<a href="#">global link</a> | <a href="#">global link</a> | <a href="#">global
link</a> | <a href="#">global link</a> | <a href="#">global link</a> | <a href="#">global
link</a> | <a href="#">global link</a>
</div>
</div>
<!-- end masthead -->
<div id="content">
<div class="feature"><!-- InstanceBeginEditable name="EditRegion1" -->
<h3>Feature Title </h3>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec molestie.
Sed aliquam sem ut arcu. Phasellus sollicitudin. Vestibulum condimentum facilisis
nulla. In hac habitasse platea dictumst. Nulla nonummy. Cras quis libero.
Cras venenatis. Aliquam posuere lobortis pede. Nullam fringilla urna id leo.
Praesent aliquet pretium erat. Praesent non odio. Pellentesque a magna a
mauris vulputate lacinia. Aenean viverra. Class aptent taciti sociosqu ad
litora torquent per conubia nostra, per inceptos hymenaeos. Aliquam lacus.
Mauris magna eros, semper a, tempor et, rutrum et, tortor.
</p>
<%
String student_number="",name="",password="",telephone="",email="",address="",department="";
int id=0,age=0,mark=0;
List result=HibernateUtil.findStudent(username);
Iterator it=result.iterator();
if(it.hasNext()){
Student student=(Student)it.next();
id=(student.getId()).intValue();
age=(student.getAge()).intValue();
mark=(student.getMark()).intValue();
student_number=student.getStudent_number();
name=student.getName();
password=student.getPassword();
telephone=student.getTelephone();
email=student.getEmail();
address=student.getAddress();
department=student.getDepartment();
}
%>
<form method="post" action="updateStudent.do">
<input type="hidden" name="id" value="<%=id%>">
<table width="80%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="48%" align="right">用户名:</td>
<td width="52%"><input name="username" type="text" value="<%=username%>">
</td>
</tr>
<tr>
<td width="48%" align="right">学生号:</td>
<td width="52%"><input name="student_number" type="text" value="<%=student_number%>">
</td>
</tr>
<tr>
<td align="right">姓名:</td>
<td><input name="name" type="text" id="name" value="<%=name%>">
</td>
</tr>
<tr>
<td align="right">密码:</td>
<td><input name="password" type="password" value="<%=password%>">
</td>
</tr>
<tr>
<td align="right">性别:</td>
<td><select name="sex" size="1">
<option>男</option>
<option>女</option>
</select>
</td>
</tr>
<tr>
<td align="right">年龄:</td>
<td><input name="age" type="text" value="<%=age%>">
</td>
</tr>
<tr>
<td align="right">电话:</td>
<td><input name="telephone" type="text" value="<%=telephone%>">
</td>
</tr>
<tr>
<td align="right">E-MAIL:</td>
<td><input name="email" type="text" value="<%=email%>">
</td>
</tr>
<tr>
<td align="right">地址:</td>
<td><input name="address" type="text" value="<%=address%>">
</td>
</tr>
<tr>
<td align="right">所在系</td>
<td><select name="department" size="1">
<option><%=department%></option>
<option>计算机</option>
<option>机械系</option>
<option>电子系</option>
<option>数理系</option>
</select>
</td>
</tr>
<tr>
<td align="right">学分:</td>
<td><input name="mark" type="text" value="<%=mark%>">
</td>
</tr>
</table>
<p align="center">
<input type="submit" name="Submit" value="修改">
</p>
</form>
</div>
<div id="sectionLinks">
<ul>
<li><a href="select_course.jsp">选修课程</a></li>
<li><a href="StudentLoginSvlt?username=<%=username%>&action=checkmark">查看学分</a></li>
<li><a href="edit_infor.jsp">修改信息</a></li>
<li><a href="logoff.do">退出</a></li>
</ul>
</div>
<div id="headlines"></div>
</div>
<!--end navbar -->
<div id="siteInfo">
<div align="center"><a href="#">About Us</a> | <a href="#">Site
Map</a> | <a href="#">Privacy Policy</a> | <a href="#">Contact Us</a> | ©2005
By Luo </div>
</div>
<br>
</body>
<!-- InstanceEnd --></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?