几个简单问题----online waiting
眼镜猴子 2003-04-01 08:49:00 本人才学jsp不久有以下几个问题:
1.java Beans与Enterprise Beans 的异同。
2.如何做才能只有通过登陆业面进入下一个业面(防止直接通过键入Url进入业面);
3。我写了以下的代码,
teaQuery.jsp
<%@ page contentType="text/html;charset=gb2312"%>
<html>
<head>
<title>教师查询窗口</title>
</head>
<body>
<div align="center" style="width: 711; height: 203">
<p><font size="7"><b><font size="+5"> 教 师 查 询 窗 口</font></b></font></p>
<form method="post" action="teaQueryExecute.jsp">
<table width="421" align="center" border=0 height="24">
<tr>
<td colspan="2" width="415" height="39"> <font size=+3>查询的字符串</font>
<input type="text" name="queryString" size="25" maxlength="50"></td>
</tr>
<tr>
<td width="121" valign="top" height="1"> <font size=+3>查询条件:</font></td>
<td width="290">
<input type="radio" name="choice" value="a1" >学号
<input type="radio" name="choice" value="a2" >姓名
<input type="radio" name="choice" value="a3" >班级号
<br>
</td>
</tr>
<td colspan="2" width="415" height="21">
<p align="center">
<input type="submit" name="send" value="查询" tabindex="1">
<input type="reset" name="reset" value="清除"></p></td>
</tr>
</table>
</form>
</div>
</body>
</html>
--------------------------------------------------
teaQueryExecute.jsp
<%@ page contentType="text/html;charset=gb2312"%>
<html>
<head><title>查询结果</title></head>
<body>
<%@ page language="java" import="java.sql.*"%>
<jsp:useBean id="sqlbean" scope="session" class="student.stuInfoBean"/>
<%! String searchStr,choice,sql;%>
<%
searchStr=request.getParameter("queryString");
choice=request.getParameter("choice");
if (choice=="a1")
sql="select M.学号,S.姓名,C.课程名,M.期中成绩,M.期末成绩,M.实验成绩,M.总评成绩 S.班级号 from MarkTable as M,StudentTable as S,CourseTable as C where M.学号=990045 and M.学号=S.学号 and C.课程号=M.课程号";
else {
if(choice=="a2")
sql="select M.学号,S.姓名,C.课程名,M.期中成绩,M.期末成绩,M.实验成绩,M.总评成绩 S.班级号 from MarkTable as M,StudentTable as S,CourseTable as C where M.学号='"+searchStr+"' and M.学号=S.学号 and C.课程号=M.课程号";
else
sql="select M.学号,S.姓名,C.课程名,M.期中成绩,M.期末成绩,M.实验成绩,M.总评成绩 S.班级号 from MarkTable as M,StudentTable as S,CourseTable as C where M.学号='"+searchStr+"' and M.学号=S.学号 and C.课程号=M.课程号";
}
ResultSet RS = sqlbean.executeQuery(sql);
while (RS.next()){
%>
<p><font size="4">查询的结果:</font></p>
<table border=1 width=50% align=center>
<tr>
<td width="30%"><div align="right">学号:</td><td width="70%"><%=RS.getString(1)%> </td>
</tr>
<tr>
<tr>
<td width="30%"><div align="right">姓名:</td><td width="70%"><%=RS.getString(2)%> </td>
</tr>
<tr>
<td width=30%><div align="right">课程名:</td><td width=70%><%=RS.getString(3) %> </td>
</tr>
<tr>
<td width="30%"><div align="right">期中成绩:</td><td width="70%"><%=RS.getString(4)%> </td>
</tr>
<tr>
<td width="30%"><div align="right">期末成绩:</td><td width="70%"><%=RS.getString(5)%> </td>
</tr>
<tr>
<td width="30%"><div align="right">实验成绩:</td><td width="70%"><%=RS.getString(6)%> </td>
</tr>
<tr>
<td width="30%"><div align="right">总评成绩:</td><td width="70%"><%=RS.getString(7)%> </td>
</tr>
<tr>
<td width="30%"><div align="right">班级号:</td><td width="70%"><%=RS.getString(8)%> </td>
</tr>
</table>
<% }
RS.close();
%>
</body>
不知那里有错误?有没有好的方法完成这个功能呀!