ImageVerifierCode 换一换
格式:DOCX , 页数:15 ,大小:118.20KB ,
资源ID:23797902      下载积分:10 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/23797902.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(JAVAWEB课程设计实验报告参考模板.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

JAVAWEB课程设计实验报告参考模板.docx

1、JAVAWEB课程设计实验报告参考模板 第一章 概述【实验目的】1.掌握java-web网站设计的全过程;2.进一步熟练Servlet技术、数据库、标签等一般java-web应用技术;3.掌握整个java-web应用架构、目录结构以及服务器使用。【需求分析】1.设计一个较完善的网上军靴商店;2.账户模块:提供用户注册、登录,考虑用户数量增减,需要用数据库技术;3.商品显示模块:出于增加销售量考虑,需要有简单广告功能,并提供商品详细参数;推广商品,网站需要对热销商品展示以及商品分类显示、商品查询;4.订单管理模块、订单详细信息模块:显示已保存的订单的详细信息;5.购物车模块:添加/删除商品,结帐

2、,显示订单信息。第二章 网上商店结构分析与设计【前言】随着信息化技术在生活中的应用越来越广泛,网上购物也逐渐成为人们的一种生活方式。本系统正是基于这样一种环境下应运而生。本电子商城为前台部分,前台主要实现会员的网上购物业务流程、用户注册、用户资料修改。 本商城主要利用javaservlet技术进行开发,有很强的逻辑性、可扩展性,便于维护。商城界面设计主要实用了CSS,美化了店面。其次本商城设计还使用了JSP技术、JDBC技术、JavaBean技术、css。2.1 系统结构图 图2.1 系统整体框图2.2系统功能分析新品上市模块:在首页框架中显示新品列表畅销商品模块:在首页框架中显示畅销列表购物

3、车模块:显示已点击购买但没结账的商品结账模块:直接显示当前订单查看商品信息模块:显示当前商品详细信息商品分类模块:分类显示商品全部商品模块:显示商品列表查询商品模块:搜寻商品,显示商品信息用户注册模块:实现用户注册统功能分析第三章 详细设计3.1数据库设计 商品表(shoe)用户表(user)用户订单表(orderinfo)3.2 商品模块实现 3.2.1 模块功能实现和关键代码说明先由JSP页面发出请求调用mypack包下GetshoeServlet,调用里面的 doGet方法,然后调用db.executeQuery(sql)方法,查询数据库,查到热销商品的列表,保存进requeset对象的

4、resault变量里,然后通过调用取出其中的值,显示到主页面。商品查询模块按商品ID、关键词查询,商品显示模块使用同样方法根据不同条件查询数据库。主要代码如下: protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException req.setCharacterEncoding(utf-8); String typeId = req.getParameter(typeId); String shoeId = req.getParameter(sho

5、eId); String keyword = req.getParameter(keyword); String sql = select * from shoe; String sql1 = select * from shoe where typeId = ?; String sql2 = select * from shoe where shoeId = ?; List shoelist = new ArrayList(); HttpSession session = req.getSession(); BookDB db = null; CachedRowSet result = nu

6、ll; try db = new BookDB(); if(typeId != null) if(typeId.equals(0) result = db.executeQuery(sql); else result = db.executeQuery(sql1, typeId); while(result.next() Shoe shoe = new Shoe(); shoe.setType(result.getString(1); shoe.setShoeId(result.getInt(2); shoe.setName(result.getString(3); shoe.setPrice

7、(result.getFloat(4); shoelist.add(shoe); session.setAttribute(shoelist, shoelist); resp.sendRedirect(req.getContextPath()+/catalog.jsp); if(shoeId != null) result = db.executeQuery(sql2, Integer.parseInt(shoeId); if(result.next() Shoe shoeDetail = new Shoe(); shoeDetail.setType(result.getString(1);

8、shoeDetail.setShoeId(result.getInt(2); shoeDetail.setName(result.getString(3); shoeDetail.setPrice(result.getFloat(4); shoeDetail.setSale_amount(result.getInt(5); session.setAttribute(shoedetail, shoeDetail); resp.sendRedirect(req.getContextPath()+/shoedetail.jsp); if(keyword != null) result = db.ex

9、ecuteQuery(sql); while(result.next() if(result.getString(3).contains(keyword) Shoe shoe = new Shoe(); shoe.setType(result.getString(1); shoe.setShoeId(result.getInt(2); shoe.setName(result.getString(3); shoe.setPrice(result.getFloat(4); shoelist.add(shoe); session.setAttribute(shoelist, shoelist); r

10、esp.sendRedirect(req.getContextPath()+/catalog.jsp); catch (Exception e) / TODO Auto-generated catch block e.printStackTrace(); 3.3 用户注册/登录模块实现3.3.1 模块功能实现和关键代码说明 先由JSP页面发出请求调用mypack包下UserRegistServlet/UserLoginServlet,调用里面的 doGet方法,然后调用db.executeQuery(sql1, username, password)方法,更新数据库。主要代码如下:登录(Use

11、rLoginServlet):HttpSession session = req.getSession(); try db = new BookDB(); result = db.executeQuery(sql1, username, password); if (result.next() user = new User(); user.setUsername(result.getString(1); user.setPassword(result.getString(2); user.setMail(result.getString(3); user.setTel(result.getS

12、tring(4); session.setAttribute(user, user); resp.sendRedirect(req.getContextPath() + /index.jsp); else resp.sendRedirect(req.getContextPath() + /login.jsp?statu=no); 注册(UserRegistServlet): String username = req.getParameter(username); String password = req.getParameter(password); String mail = req.g

13、etParameter(mail); String tel = req.getParameter(tel); String sql1 = select * from user where username = ?; String sql2 = insert into user values(?, ?, ?, ?); BookDB db; CachedRowSet result = null; try db = new BookDB(); result = db.executeQuery(sql1, username); if(result.next() resp.sendRedirect(re

14、q.getContextPath()+/regist.jsp?statu=no); else db.executeUpdata(sql2, username, password, mail, tel); resp.sendRedirect(req.getContextPath()+/regist.jsp?statu=ok); 3.4 购物车模块实现 3.4.1 模块功能实现和关键代码说明图3.1 购物车模块流程图 先由JSP页面发出请求调用org.action包下的findId方法,findId调用DaoImpl包里的findOrderById,把得到的结果,保存到session里取名orde

15、r1通过orderdetail里取变量得到这个值,显示到主页面。主要代码如下:Add()方法: public synchronized void add(String shoeId, Shoe shoe) if(items.containsKey(shoeId) ShoppingCartItem scitem = (ShoppingCartItem) items.get(shoeId); scitem.incrementQuantity(); else ShoppingCartItem newItem = new ShoppingCartItem(shoe); items.put(shoeId

16、, newItem); numberOfItems+; Remove()方法: public synchronized void remove(String shoeId) if(items.containsKey(shoeId) ShoppingCartItem scitem = (ShoppingCartItem) items.get(shoeId); scitem.decrementQuantity(); if(scitem.getQuantity() = 0) items.remove(shoeId); numberOfItems-; Gettotal()方法:public synch

17、ronized double getTotal() double amount = 0.0; for(Iterator i = getItems().iterator(); i.hasNext(); ) ShoppingCartItem item = (ShoppingCartItem) i.next(); Shoe shoe = (Shoe) item.getItem(); amount += item.getQuantity() * shoe.getPrice(); return roundOff(amount); private double roundOff(double x) lon

18、g val = Math.round(x*100); / cents return val/100.0; public synchronized void clear() items.clear(); numberOfItems = 0; 3.5 结算功能模块从showcart.jsp转到cashier.jsp,调用HandleOrderServlet的db.buyBooks(cart)方法和db.executeUpdata( )方法更新数据库。主要代码如下:String sql = insert into orderinfo values(?, ?, ?, ?, ?); BookDB db;

19、 try db = new BookDB(); db.buyBooks(cart); db.executeUpdata(sql, orderId,username, cardname, cardnum, payment); resp.sendRedirect(req.getContextPath()+/cashier.jsp?makeorder=ok); catch (Exception e) .printStackTrace(); 第四章 总结【技术总结】1.一个Servlet往往对应了不同的操作,一个对象的增删改查,都放在了一个Servlet里面实现,这样设计可有效减少Servlet数量;2.对于网页页面效果要求较高的时候,多采用JSP来编写,对于后台处理要求较高时,多采用Servlet。3.尽量使用和数据库版本一致的驱动,否则jdbc连接可能不正常;4. 在编写样式表之前一定要注意CSS文档的编码类型一定要和HTML文档的字符集类型一致。【心得体会】通过这次课程设计,使我加深了对javaweb应用结构的理解,掌握了javaweb应用设计的流程及各个模块间协同关系,学会了使用css美化个人设计。 友情提示:范文可能无法思考和涵盖全面,供参考!最好找专业人士起草或审核后使用,感谢您的下载!

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1