package org.javaee.severlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.javaee.dao.OrderOperation;
public class ProcessOrder extends HttpServlet {
public ProcessOrder() {
super();
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//设置中文响应编码
response.setContentType("text/html;charset=gbk");
//获取session对象
HttpSession session=request.getSession();
//获取order.jsp页面中的用户输入数据信息
String username=request.getParameter("username");
String zipcode=request.getParameter("zipcode");
String phone=request.getParameter("phone");
String creditcard=request.getParameter("creditcard");
// 计算价钱
Object total=session.getAttribute("total");
double zje=0;
if(total!=null){
zje=((Double)total).doubleValue();
}
//进行数据库操作时,需要保存订单信息,因此调用订单业务类实例中的方法,实现数据库操作
//根据操作结果进行页面转向
OrderOperation op=new OrderOperation();
int i=op.saveOrder(username, zipcode, phone, creditcard, zje);
if(i>0){
response.sendRedirect("../jsp/success.jsp");
session.invalidate();
}else{
response.sendRedirect("../jsp/order.jsp");
}
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
java web 电子书店系统
共99个文件
jpg:29个
gif:16个
class:14个
4星 · 超过85%的资源 需积分: 10 21 下载量 117 浏览量
2012-05-22
21:10:40
上传
评论
收藏 1.57MB RAR 举报
温馨提示
在myeclipse中运行的一个简单的小程序,数据库使用sql server 2005,适合初学者使用。
资源推荐
资源详情
资源评论
收起资源包目录
books.rar (99个子文件)
books
books_log.LDF 560KB
.settings
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.jsdt.ui.superType.container 49B
.jsdtscope 500B
org.eclipse.jdt.core.prefs 330B
src
org
javaee
dao
UserManagerBean.java 885B
OrderOperation.java 1KB
TitlesBean.java 1KB
CheckLogin.java 868B
OrderOperationBean.java 1KB
ConnectionManager.java 1KB
severlet
ProcessOrder.java 3KB
AddBookToCart.java 3KB
Register.java 2KB
Counter.java 2KB
entity
BookBean.java 2KB
Order.java 1KB
UserBean.java 882B
CartItemBean.java 432B
.project 1KB
WebRoot
images
design.jpg 7KB
cpphtp2.jpg 13KB
topbt1.gif 80B
top1bg.jpg 365B
cpphtp3.jpg 16KB
bg1.gif 27KB
bk.gif 6KB
msn.gif 4KB
CHOP1.gif 34KB
CHOP2gif.gif 25KB
topbt4.gif 80B
javactc3.jpg 16KB
cppctc3.jpg 8KB
perlhtp1.jpg 14KB
topbt5.gif 82B
htmlmoban.js 217B
topbt3.gif 80B
chtp3.jpg 17KB
icon1.gif 104B
bn01.jpg 39KB
iw3ctc1.jpg 14KB
leftbg.gif 44B
chtp2.jpg 11KB
xmlhtp1.jpg 16KB
jhtp3.jpg 16KB
advjhtp1.jpg 19KB
top3.jpg 11KB
ebechtp1.jpg 19KB
logo.jpg 4KB
bn01~.gif 49KB
javactc2.jpg 12KB
bg.jpg 2KB
vbctc1.jpg 13KB
E-book.html 2KB
top01.gif 126B
top4.jpg 11KB
vbhtp1.jpg 16KB
top1.jpg 11KB
bn01~.jpg 49KB
top2.jpg 11KB
bnbg1.gif 92B
背景.jpg 56KB
jhtp2.jpg 15KB
qq.gif 169B
白云.jpg 63KB
iw3htp1.jpg 18KB
topbt2.gif 80B
main.css 2KB
META-INF
MANIFEST.MF 36B
WEB-INF
web.xml 2KB
classes
org
javaee
dao
ConnectionManager.class 2KB
CheckLogin.class 2KB
OrderOperation.class 1KB
UserManagerBean.class 2KB
TitlesBean.class 2KB
OrderOperationBean.class 1KB
severlet
Counter.class 2KB
ProcessOrder.class 2KB
AddBookToCart.class 2KB
Register.class 2KB
entity
Order.class 2KB
CartItemBean.class 859B
BookBean.class 2KB
UserBean.class 1KB
lib
sqljdbc.jar 570KB
index.jsp 834B
jsp
order.jsp 5KB
displayBook.jsp 6KB
temp.jsp 4KB
processorder.jsp 2KB
order1.jsp 5KB
output.jsp 1KB
books.jsp 6KB
register.jsp 5KB
success.jsp 6KB
viewCart.jsp 6KB
.mymetadata 288B
books.mdf 2.19MB
.classpath 432B
.myeclipse
共 99 条
- 1
资源评论
- liang_javaweb2012-12-04没什么大问题
- messi_life2012-12-10结构比较坚强,但是有很多小问题
- chichicken2012-07-22恩,不错,但有点小问题
ltf_1987
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 以简单、易用、高性能为目标、开源的时序数据库,支持Linux及Windows, Time Series Database.zip
- python-leetcode面试题解之第198题打家劫舍-题解.zip
- python-leetcode面试题解之第191题位1的个数-题解.zip
- python-leetcode面试题解之第186题反转字符串中的单词II-题解.zip
- 一个基于python的web后端高性能开发框架,下载可用
- python-leetcode面试题解之第179题最大数-题解.zip
- python-leetcode面试题解之第170题两数之和III数据结构设计-题解.zip
- python-leetcode面试题解之第168题Excel表列名称-题解.zip
- python-leetcode面试题解之第167题两数之和II输入有序数组-题解.zip
- python-leetcode面试题解之第166题分数到小数-题解.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功