清华大学出版社郭克华JavaWeb程序设计上机习题答案

欢迎您的光临, <%

String account=(String)(\ (account); %> 9-6、

<%@ page language=\

账户:

<%

String account=(\ String pwd=(\ String flag=(\

if(account!=null&&pwd!=null) {

if(\ {

(\ (\

if(flag!=null&&(\ {

Cookie account_cookie=new Cookie(\ (6000);

Cookie pwd_cookie=new Cookie(\ (6000);

(account_cookie); (pwd_cookie); } (\ } else

(\请确认输入了正确的用户和密码!\ } %> 9-6-1、

<%@ page language=\

欢迎您的光临, <%

String account=(String)(\ (account); %> Servlets、 9-2*

package servlets;

public class BookAdd extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session=(); ArrayList booksBuy=(ArrayList)(\ if(booksBuy==null) { booksBuy=new ArrayList(); (\ } String addbook=(\ addbook=new String(\ import .*; import .*;

public class BookQuery extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = (); String bookname=(\ try { Connection conn = (\ Statement stat = (); String sql = \Like '%\ ResultSet rs = (sql); HttpSession session=(); ArrayList books=new ArrayList(); while()) {

ArrayList book=new ArrayList(); (\ (\ (\ (book); } (\ etSession();endRedirect(\ account=(String)(\ if(account==null)etCookies(); if(cookies!=null)etName().equals(\ account=cookies[i].getValue(); if(cookies[i].getName().equals(\ pwd=cookies[i].getValue(); if(account!=null&&pwd!=null) break; } if(account!=null&&pwd!=null)endRedirect(\ } else ((HttpServletResponse)response).sendRedirect(\ } (request, response); } } 、

EncodingFilter

SessionFilter

CookieFilter

EncodingFilter /*

SessionFilter /

CookieFilter /

BookQuery

BookAdd

BookSee

BookDel

BookQuery4

driverClassName

url

jdbc:odbc:DSSchool

BookQuery /servlets/BookQuery

BookAdd /servlets/BookAdd

BookSee /servlets/BookSee

BookDel

/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=\

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4