完善成功
11.25
今天完成了对web代码的完善,没有遇道什么问题,明天计划再弄一个新的web系统。
代码部分:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="com.pp.DBU" %>
<%@page import = "java.sql.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String sql="select * from xuesheng";
Connection conn= DBU.getConnection();
PreparedStatement papre=conn.prepareStatement(sql);
ResultSet rs=papre.executeQuery();
String n=request.getParameter("xingming");
boolean s=true;
session.setAttribute("xingming",n);
while(rs.next()){
if(n.equals(rs.getString("xingming"))){
out.println(rs.getString("xuehao")+"   "+rs.getString("xingming")+"   "+rs.getString("banji")+"   "+rs.getString("kecheng")+"   "+rs.getString("fenshu")+"   ");
out.print("<br />");
s=false;
}
}
%>
<% if(s){
%>
<jsp:forward page = "wuci.jsp"></jsp:forward>
<%
}
%>
<form action="xiugai" method="get">
<table>
<tr>
<td>学号</td>
<td>
<input type="text" name="xuehao" pattern="[0-9]{5}" title="只能输入数字或最后一位为X">
</td>
</tr>
<tr>
<td>姓名</td>
<td>
<input type="text" name="xingming">
</td>
</tr>
<tr>
<td>班级</td>
<td>
<input type="text" name="banji">
</td>
</tr>
<tr>
<td>课程</td>
<td>
<input type="text" name="kecheng">
</td>
</tr>
<tr>
<td>分数</td>
<td>
<input type="text" name="fenshu">
</td>
</tr>
<tr align="center">
<td colspan="2">
<input type="submit" value="提交">
</td>
<td colspan="2">
<input type="submit" value="返回" formaction="guanli.jsp">
</td>
</tr>
</table>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="update.jsp" border="1">
<table align = "center" border = "1">
<tr>
<td>请输入要修改的名称:</td>
<td>
<input type="text" name="xingming">
</td>
</tr>
<tr align="center">
<td colspan="2">
<input type="submit" value="确定">
</td>
</tr>
</table>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="xuesheng" method="get">
<table align="center" border="1">
<tr>
<td>学号</td>
<td>
<input type="text" name="xuehao">
</td>
</tr>
<tr>
<td>姓名</td>
<td>
<input type="text" name="xingming">
</td>
</tr>
<tr>
<td>班级</td>
<td>
<input type="text" name="banji">
</td>
</tr>
<tr>
<td>课程</td>
<td>
<input type="text" name="kecheng">
</td>
</tr>
<tr>
<td>分数</td>
<td>
<input type="text" name="fenshu">
</td>
</tr>
<tr align="center">
<td colspan="2">
<input type="submit" value="提交">
</td>
<td colspan="2">
<input type="submit" value="返回" formaction="guanli.jsp">
</td>
</tr>
</table>
</form>
</body>
</html>