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

📄 showscore.jsp

📁 jsp+access简易选课系统
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@page import="java.util.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
body {
	background-image: url(images/surface.jpg);
}
-->
</style></head>
<body>
<%!
	String accountID ="";
%>
<%		
	if(session.isNew())		response.sendRedirect("Index.jsp");
	else	
	{
		Object id = session.getAttribute("id");
		accountID = id.toString();
	}
%>
<form>
<table align="center">
<tr>
<td align="right"><input type="radio" name="choice" value="s" checked="ok"></td>
<td align="left">根据课程名查找</td>
<td align="right"><input type="radio" name="choice" value="m"></td>
<td align="left">根据学期查找</td>
</tr>
</table>
<p align="center"><input type="text" name="text" height="30" size="30"></p>
<p align="center"><input type="submit" name+"submit" value="查找"></p>
</form>
<% 
		 if(request.getParameter("text")!=null)
		 {
		   String choose =request.getParameter("choice");
		   String text1=request.getParameter("text");
		   byte b[]=text1.getBytes("ISO-8859-1");
		   text1=new String(b);
		   try{
		   ResultSet result=null;
%>
<jsp:useBean id="search" class="student.ShowScore" />
<jsp:setProperty name="search" property="name" value="<%= text1 %>" />
<jsp:setProperty name="search" property="SID" value="<%=accountID %>"/>
<jsp:setProperty name="search" property="choice" param="choice"/>
<%			     
			  int i=0;
			  int score;
			  String exam;
			  if(choose.equals("s"))
			  {
			      out.println("课程名为:"+text1+"的有关情况");
			  }
			  else
			     out.println(text1+"的课程有关情况");
			  result=search.getResult();
			  out.println("<table>");
			  out.println("<tr>"+"<th>课程号</th><th>课程名</th><th>任课老师</th><th>是否考核</th><th>分数</th>");
			while(result.next())
			{
			  i++;
			  score=result.getInt(4);
			  if(score==0)
			  {
                  exam="否";
				  out.println("<tr><td>"+result.getInt(1)+"</td><td>"+result.getString(2)+"</td><td>"+result.getString(3)+"</td><td>"+exam+"</td><td></td></tr>");			
		   	 }
			  else 
			  {    
			       exam="是";
				   out.println("<tr><td>"+result.getInt(1)+"</td><td>"+result.getString(2)+"</td><td>"+result.getString(3)+"</td><td>"+exam+"</td><td>"+score+"</td></tr>");
			  }
			}
			out.println("</table>");
			search.Close();
		    if(i==0)
			     out.println("<script>alert('不存在记录!');</script>");
			}
			catch(Exception e)
			{
			out.println(e);
			}
	    }
%>
</body>
</html>

⌨️ 快捷键说明

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