安装APP,随时看
文档分类
当前位置:首页 > 清华大学出版社郭克华JavaWeb程序设计上机习题答案
CookieFilter /
BookQuery
BookAdd
BookSee
BookDel
BookQuery4
driverClassName
url
jdbc:odbc:DSSchool
BookQuery /servlets/BookQuery
BookAdd /servlets/BookAdd
BookSee /servlets/BookSee
/servlets/BookDel
BookQuery4 /servlets/BookQuery4
BASIC
Chapter10
10-3、
<%@ page language=\<%@ page import=\
请输入学号: <%
(\
String sno=(\
String sname=(\ if(sno!=null&&sname!=null) {
(sname);
StudentDao studentdao=new StudentDao(); Student student=(sno); if())) {
(\ (\ } } %> 10-3-1、
<%@ page language=\
欢迎您,<% (\ 10-4、
ArrayList students=(ArrayList)(\ if(students!=null) {
for(int i=0;i<();i++) {
Student student=(Student)(i); ()+\ } } %>
Servlets、
package servlets; import ;
public class SearchStudent extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { (\ String stuname=(\ if(stuname!=null) { StudentInfoDao infodao=new StudentInfoDao(); ArrayList infoList=null; try { infoList = (stuname); } catch (Exception e) { // TODO Auto-generated catch block (); } if(infoList!=null)
{ HttpSession session=(); (\ } } (\ } }
Beans、
(略。。。。) Dao、
package dao; import ;
public class StudentInfoDao { public ArrayList queryAllStudents(String stuname) throws Exception { Connection conn = null; ArrayList students= new ArrayList(); try { //获取连接 String url=\ conn = (url, \ // 运行SQL语句 String sql = \LIKE '%\ Statement stat = (); ResultSet rs = (sql); while ()) {
//实例化VO Student student = new Student(); (\ (\ (\ (student); } (); (); } catch (SQLException e) { (); } finally { try {// 关闭连接 if (conn != null) { (); conn = null; }
}
} catch (Exception ex) { } }
return students;
共分享92篇相关文档