jsp页面

12.5;

今天继续做昨天的web系统,做了一些jsp的页面,功能还不是很完善,没有遇到什么问题,明天计划继续写学生成绩管理系统,并吧学生成绩管理系统做完。

下面是代码部分;

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>全部信息</title>
</head>
<body >

<div align="center">
<h1 style="color: red;" align="center"> 所有成员信息列表</h1>
<table border="1px" cellspacing="0" cellpadding="5px">
<tr height="35px">
<td><h3 style="color: yellow;">学号</h3></td>
<td><h3 style="color: yellow;">姓名</h3></td>
<td><h3 style="color: yellow;">班级</h3></td>
<td><h3 style="color: yellow;">课程</h3></td>
<td><h3 style="color: yellow;">分数</h3></td>
</tr>
<tr height="35px">
<c:forEach items="${allthing}" var="item" >
<td>${item.id }</td>
<td>${item.name }</td>
<td>${item.clas }</td>
<td>${item.ke }</td>
<td>${item.score }</td>

</tr>
</c:forEach>
</table>
<a href="TheMain.jsp"><h2 align="center">点击此处返回主页面</h2></a>
</div>
</body>
</html>

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>删除学生信息</title>
</head>
<body text="yellow" style="background: url(images/wen7.jpg); background-size:100%" >
<h2 align="center">请输入想要删除信息的用户名</h2>
<form action="UserServlet?method=deletecheck" onsubmit="return chackall()" method="post" >

<%
Object message = request.getAttribute("message");//放置一个字符串,并取出
if(message!=null && !"".equals(message)){

%>
<script type="text/javascript">
alert("<%=request.getAttribute("message")%>");
</script>
<%} %>

<table align="center">
<tr><td>名字:</td>
<td><input type="text" id="name4" name="name4" style=" border-color:Lime;border-radius:6px;" maxlength="12" value="" placeholder="请输入账户名" /></td>
<tr><td></td><td>
<input type="submit" value="删除此用户所有信息" style="background-color:CornflowerBlue;150px;height:25px;border-radius:4px;" ></td>
<a href="TheMain.jsp"><h3 align="center">点击此处回到主页面!!!!!!</h4></a>
<script type="text/javascript">

//重置按钮处添加onclick调用formReset %>
function checkZhanghao()
{
var zhanghao = document.getElementById("zhanghu4");
var zhanghao1=zhanghao.value;
var reg = /^[a-z][a-z0-9A-Z]{6}/;
var ref= /^[A-Z][a-z0-9A-Z]{6}/
if(reg.test(zhanghao1)||ref.test(zhanghao1)){
//符合规则
return true;
}else{
//不符合规则
alert('账户格式错误,应以英文字母开头并且7位及以上');
zhanghao.value = "";
zhanghao.focus();
return false;
}
}
function chackall() {
var zhanghu3=document.getElementById("zhanghu4");
if(zhanghu3.value=="")
{
alert("用户名不能为空");
zhanghu3.focus();
return false;
}
return true;
}
</script>

</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 text="yellow" style="background: url(images/wen5.jpg); background-size:100%">
<%
Object message = request.getAttribute("message");//放置一个字符串,并取出
if(message!=null && !"".equals(message)){

%>
<script type="text/javascript">
alert("<%=request.getAttribute("message")%>");
</script>
<%} %>
<h2 align="center">恭喜您删除消息成功!!!!!</h2>
<a href="TheMain.jsp"><h2 align="center">点击此处返回到主页面</h2></a>
</body>
</html>

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>再次确定删除</title>
</head>
<style>
a:link {color:blue;}
a:visited {color:blue;}/*选择未访问、已访问、悬浮和活动链接,并设置它们的样式:*/
a:hover {color:red;}
a{
font-size:18px;
font-family:"楷体";/*设置字体*/
font-weight:2px;
}
h1{
color:red;
font-size:44px;
}
</style>
<body text="red" >
<div align="center">
<h1 style="color: red;" align="center"> 所有成员信息列表</h1>
<table width="900">
<tr>
<tr height="35px">
<td><h3 style="color: yellow;">学号</h3></td>
<td><h3 style="color: yellow;">姓名</h3></td>
<td><h3 style="color: yellow;">班级</h3></td>
<td><h3 style="color: yellow;">课程</h3></td>
<td><h3 style="color: yellow;">分数</h3></td>
</tr>
<tr height="35px">
<c:forEach items="${Thething1 }" var="item" >
<td>${item.id }</td>
<td>${item.name }</td>
<td>${item.clas }</td>
<td>${item.ke }</td>
<td>${item.score }</td>

<td><a href="UserServlet?method=delete&name=${item.name }" onclick="return check()">删除</a>

</c:forEach>
</tr>


</table>
<script type="text/javascript">
function check() {
if (confirm("真的要删除吗?")){
return true;
}else{
return false;
}
}
</script>

<a href="TheMain.jsp"><h2 align="center">点击此处返回主页面</h2></a>
</html>

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>成绩排序结果</title>
</head>
<body>
<div align="center">
<h1 style="color: red;" align="center"> 所有成员信息列表</h1>
<table border="1px" cellspacing="0" cellpadding="5px">
<tr height="35px">
<td><h3 style="color: yellow;">学号</h3></td>
<td><h3 style="color: yellow;">姓名</h3></td>
<td><h3 style="color: yellow;">班级</h3></td>
<td><h3 style="color: yellow;">课程</h3></td>
<td><h3 style="color: yellow;">分数</h3></td>
</tr>
<tr height="35px">
<c:forEach items="${things}" var="item" >
<td>${item.id }</td>
<td>${item.name }</td>
<td>${item.clas }</td>
<td>${item.ke }</td>
<td>${item.score }</td>

</tr>
</c:forEach>
</table>
<a href="TheMain.jsp"><h2 align="center">点击此处返回主页面</h2></a>
</div>
</body>
</html>

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>查找学生信息</title>

<script>
var i=1;
var j=1;
document.getElementById('number1').value=i;
document.getElementById('number2').value=j;
function demoDisplay(){
if(document.getElementById("p2").style.display=="none"){
i++;
j++;
document.getElementById("p2").style.display="inline";
document.getElementById('number1').value=i;
document.getElementById('number2').value=j;
// alert(i);
// alert(j);
return;
}else if(document.getElementById("p3").style.display=="none")
{
i++;
j++;
document.getElementById("p3").style.display="inline";
document.getElementById('number1').value=i;
document.getElementById('number2').value=j;
// alert(i);
// alert(j);
return;
}else if(document.getElementById("p4").style.display=="none")
{
i++;
j++;
document.getElementById("p4").style.display="inline";
document.getElementById('number1').value=i;
document.getElementById('number2').value=j;
// alert(i);
// alert(j);
return;
}else if(document.getElementById("p5").style.display=="none")
{
i++;
j++;
document.getElementById("p5").style.display="inline";
document.getElementById('number1').value=i;
document.getElementById('number2').value=j;
// alert(i);
// alert(j);
return;
}
}
function demoVisibility(){
if(document.getElementById("p5").style.display=="inline")
{
i--;
j--;
document.getElementById("p5").style.display="none";
document.getElementById('number1').value=i;
document.getElementById('number2').value=j;
//System.out.println("i:"+i+"j"+j);
return;
}else if(document.getElementById("p4").style.display=="inline")
{
i--;
j--;
document.getElementById("p4").style.display="none";
document.getElementById('number1').value=i;
document.getElementById('number2').value=j;
//System.out.println("i:"+i+"j"+j);
return;
}else if(document.getElementById("p3").style.display=="inline")
{
i--;
j--;
document.getElementById("p3").style.display="none";
document.getElementById('number1').value=i;
document.getElementById('number2').value=j;
//System.out.println("i:"+i+"j"+j);
return;
}else if(document.getElementById("p2").style.display=="inline")
{
i--;
j--;
document.getElementById("p2").style.display="none";
document.getElementById('number1').value=i;
document.getElementById('number2').value=j;
//System.out.println("i:"+i+"j"+j);
return;
}
}
</script>

</head>
<body>
<%
Object message=request.getAttribute("message");
if(message!=null&&!"".equals(message)){
%>

<script type="text/javascript">
alert("<%=request.getAttribute("message")%>");
</script>
<%}%>
<form action="Servlet" method="post">
<br>
&nbsp;&nbsp;
<button type="button" onclick="demoDisplay()" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">+</i></button>
<button type="button" onclick="demoVisibility()" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">-</i></button><br>

&nbsp;&nbsp;
<div id="p1">
&nbsp;&nbsp;
<select name="g22" style="visibility:hidden">
<option value="且">且</option>
<option value="或">或</option>
</select>
<select name="s1" >
<option>学号</option>
<option>姓名</option>
<option>班级</option>
<option>课程</option>
<option>分数</option>
</select>
<input type="text" name="shuru1" value="" />
<select name="c1">
<option>精确</option>
<option>模糊</option>
</select>
<br>
</div>

<div id="p2" style="display:none">
&nbsp;&nbsp;
<select name="g1" >
<option value="且">且</option>
<option value="或">或</option>
</select>
<select name="s2">
<option>学号</option>
<option>姓名</option>
<option>班级</option>
<option>课程</option>
<option>分数</option>
</select>
<input type="text" name="shuru2" value="" />
<select name="c2">
<option>精确</option>
<option>模糊</option>
</select>
<br>
</div>

<div id="p3" style="display:none">
&nbsp;&nbsp;
<select name="g2">
<option value="且">且</option>
<option value="或">或</option>
</select>
<select name="s3">
<option>学号</option>
<option>姓名</option>
<option>班级</option>
<option>课程</option>
<option>分数</option>
</select>
<input type="text" name="shuru3" value="" />
<select name="c3">
<option>精确</option>
<option>模糊</option>
</select>
<br>
</div>

<div id="p4" style="display:none">
&nbsp;&nbsp;
<select name="g3">
<option value="且">且</option>
<option value="或">或</option>
</select>
<select name="s4">
<option>学号</option>
<option>姓名</option>
<option>班级</option>
<option>课程</option>
<option>分数</option>
</select>
<input type="text" name="shuru4" value="" />
<select name="c4">
<option>精确</option>
<option>模糊</option>
</select>
<br>
</div>

<div id="p5" style="display:none">
&nbsp;&nbsp;
<select name="g4">
<option value="且">且</option>
<option value="或">或</option>
</select>
<select name="s5">
<option>学号</option>
<option>姓名</option>
<option>班级</option>
<option>课程</option>
<option>分数</option>
</select>
<input type="text" name="shuru5" value="" />
<select name="c5">
<option>精确</option>
<option>模糊</option>
</select>
</div>
<p hidden>
<input type="text" value="1" id="number1" name="number1">
<input type="text" value="1" id="number2" name="number2">
</p>
<br>
<input type="submit" name="submit" value="查询" >
</form>
<br>
<h4 align="left">
<%-- 一共查询到了<span style="color:red"><%=list.size() %></span>条数据 --%>
</h4>
<table class="table table-striped">
<a href="TheMain.jsp"><h3 align="left">点击此处回到主页面!!!!!!</h4></a>
</table>

</body>
</html>

原文地址:https://www.cnblogs.com/092e/p/14169927.html