Chapter2
Frame、
   Login:
          Main、
(Section C) Regiter、
ID              
Password        
Last Name       
Address         
City            
Country         
Select Interest
Question       
Answer           Top、
Treemenu、
作者的个人简介、
作者:局局局
Chapter3
1、
2、
(2)<%@page language=\
<%!String str;
int[]monReturn=new int[5];
int[]monElements=new int[]{50,20,10,5,1}; void moneyDeal(int mon){ for(int i=0;i<5;i++){
monReturn[i]=(int)(mon/monElements[i]); mon=mon%monElements[i]; } } %>
(3)<%@page language=\
<%!int[]monReturn=new int[5];
int[]monElements=new int[]{50,20,10,5,1}; void moneyDeal(int mon){ for(int i=0;i<5;i++){
monReturn[i]=(int)(mon/monElements[i]); mon=mon%monElements[i]; } } %>
(4)<%@page language=\
<%!String str;
int[]monReturn=new int[5];
int[]monElements=new int[]{50,20,10,5,1}; void moneyDeal(int mon){ for(int i=0;i<5;i++){
monReturn[i]=(int)(mon/monElements[i]); mon=mon%monElements[i]; } } %>
7-4-1、
<%@ page language=\
<%! String color=\<%
color=(\ if (color==null) {
Cookie[] cookies=(); for( int i=0;i<;i++){
if(cookies[i].getName().equals(\ {color=cookies[i].getValue(); break;} } } else {
Cookie cookie=new Cookie(\ (360000); (cookie); } %>
<%@ page language=\
<% ArrayList
books=new ArrayList
String book=(\ if(book!=null){
book=new String(\ (book); } %>
已成功加入购物车,稍后进行付款。
<%@ page language=\
<%String str=(\
str=new String(\
ArrayList
(\你并没有 购买这本书\ } else
for(int i=0;i<();i++ ){ String a=(String)(i); if(a)){ (i);
(\ break; } } %>
你要的书已在购物车中被删除
8-2、
<%@ page language=\
帐号:
密码: <%
String straccount=(\ String strpassword=(\
if(straccount!=null&&strpassword!=null&&(strpassword)) {
ArrayList sbs=(ArrayList)(\ if(sbs==null) {
sbs=new ArrayList(); (\ }
if(straccount!=null){
straccount=new String(\ (straccount); } (\ } %>
8-3-1、
<%@ page language=\
当前在线成员有:
<%
ArrayList sbs=(ArrayList)(\ for( int i=0;i<();i++) {
(i)+\ }
(\共有\人在线\ %>
Chapter9
9-1、
<%@ page language=\
输入图书名称: <%
ArrayList booksQuery=(ArrayList)(\ if(booksQuery!=null) {
for(int i=0;i<();i++) {
String book=\
ArrayList bookinfo=(ArrayList)(i); for(int j=0;j<();j++) book+=(String)(j); (book+\ } } %> 9-2、
<%@ page language=\
输入图书名称: <%
ArrayList booksQuery=(ArrayList)(\ if(booksQuery!=null) {
for(int i=0;i<();i++) {
String book=\
ArrayList bookinfo=(ArrayList)(i); for(int j=0;j<();j++) book+=(String)(j); (book);
(\添加到购物车
\ }
(\查看购物车\ } %> 9-2-1、
<%@ page language=\
<%ArrayList booksBuy=(ArrayList)(\ if(booksBuy!=null) {
for(int i=0;i<();i++) {
String book=(String)(i);
(book+\删除\ } } %>
<%@ page language=\
输入图书名称:
<%
ArrayList booksQuery=(ArrayList)(\ if(booksQuery!=null) {
for(int i=0;i<();i++) {
String book=(String)(i); (book);
(\ } } %> 9-5、
<%@ page language=\
账户: <%
String account=(\ String pwd=(\
if(account!=null&&pwd!=null) {
if(\ {
(\ (\ (\ } else
(\请确认输入了正确的用户和密码!\ } %> 9-5-1、
<%@ page language=\
欢迎您的光临, <%
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); } } 、
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、
<%@ page language=\<%@ page import=\
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;
相关推荐: