几个简单问题----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>
不知那里有错误?有没有好的方法完成这个功能呀!
...全文
59 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
眼镜猴子 2003-04-01
  • 打赏
  • 举报
回复
up
眼镜猴子 2003-04-01
  • 打赏
  • 举报
回复
up
眼镜猴子 2003-04-01
  • 打赏
  • 举报
回复
好像是nullpointerException ......
程序逻辑上有问题吗?
zxhong 2003-04-01
  • 打赏
  • 举报
回复
什么错误?
眼镜猴子 2003-04-01
  • 打赏
  • 举报
回复
问题2能给一个例子吗?
大家帮我看看问题3,很急!!!
谢谢
网络咖啡 2003-04-01
  • 打赏
  • 举报
回复
2。使用添加请求数据,然后在指定的页面交换
dongdongshu 2003-04-01
  • 打赏
  • 举报
回复
至于第三个问题,了解了前两个,多留心,仔细找找,一定是个很小的问题,我还很忙,就不看了。
dongdongshu 2003-04-01
  • 打赏
  • 举报
回复
1.java Beans与Enterprise Beans 的异同。
----java Beans是用于JSP的简单的CLASS,也就是说,封装了简单业务逻辑的.CLASS文件。
当然,这些功能你完全可以不采用BEAN而直接使用JSP实现,比如连接数据库的BEAN、替换字符串的BEAN。用了BEAN,可以提高程序的内聚性、健壮性、重用性等等。
-----而Enterprise Beans 是J2EE的核心,包含了可扩展的复杂企业事务逻辑。它可以是一个CLASS,也可以是多个CLASS,也可以是一个JAR,
2.如何做才能只有通过登陆业面进入下一个业面(防止直接通过键入Url进入业面);
使用SESSION或者COOKIE,
在登陆页产生SESSION,其他每个页面进行检测——SESSION存在与否、正确与否。

眼镜猴子 2003-04-01
  • 打赏
  • 举报
回复
郁闷!!!
眼镜猴子 2003-04-01
  • 打赏
  • 举报
回复
人呢?

81,090

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧