真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

網(wǎng)上書(shū)城java項(xiàng)目代碼,網(wǎng)上書(shū)城java項(xiàng)目代碼是多少

用java編寫(xiě)一個(gè)電子書(shū)店程序

懸賞什么的不值錢(qián)的,沒(méi)人愿意花時(shí)間做這個(gè)的,推薦CSDN網(wǎng)站自己找找類似的,然后改改,如果改的能力都沒(méi)有的話,那也就沒(méi)辦法了

創(chuàng)新互聯(lián)于2013年創(chuàng)立,先為商南等服務(wù)建站,商南等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為商南企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問(wèn)題。

求Java語(yǔ)言為書(shū)城設(shè)計(jì)一個(gè)簡(jiǎn)單購(gòu)物車類。

public class ShoppingCart {//購(gòu)物車類

private Producted prod;//商品類,存放商品信息

private int num;//商品數(shù)量

public Producted getProd() {

return prod;

}

public void setProd(Producted prod) {

this.prod = prod;

}

public int getNum() {

return num;

}

public void setNum(int num) {

this.num = num;

}

}

public class Producted {//商品類

private String prodName;//商品名稱

private Double marketPrice;//市場(chǎng)價(jià)

private Double sellPrice;//本店價(jià)

private Double save;//優(yōu)惠

private Short points;//積分

public String getProdName() {

return prodName;

}

public void setProdName(String prodName) {

this.prodName = prodName;

}

public Double getMarketPrice() {

return marketPrice;

}

public void setMarketPrice(Double marketPrice) {

this.marketPrice = marketPrice;

}

public Double getSellPrice() {

return sellPrice;

}

public void setSellPrice(Double sellPrice) {

this.sellPrice = sellPrice;

}

public Double getSave() {

return save;

}

public void setSave(Double save) {

this.save = save;

}

public Short getPoints() {

return points;

}

public void setPoints(Short points) {

this.points = points;

}

}

有用請(qǐng)采納

某網(wǎng)上書(shū)城可以查詢、刪除書(shū)籍,現(xiàn)要求使用JSP實(shí)現(xiàn)該功能

簡(jiǎn)單的增刪改查功能

package?EBookDao;

import?java.sql.Connection;

import?java.sql.PreparedStatement;

import?java.sql.ResultSet;

import?java.sql.SQLException;

import?java.util.ArrayList;

import?java.util.List;

import?DBUtil.DBUtil;

import?DBUtil.EBook;

/*

*查詢書(shū)集信息

*?

*?*/

public?class?EBookCZ?{

public?ListEBook?find()?{

Connection?conn?=?null;

PreparedStatement?ps?=?null;

ResultSet?rs?=?null;

ListEBook?list?=?new?ArrayListEBook();

try?{

conn?=?DBUtil.getConnection();

String?sql?=?"SELECT?*?FROM?ebook";

ps?=?conn.prepareStatement(sql);

rs?=?ps.executeQuery();

while?(rs.next())?{

EBook?eBook?=?new?EBook();

eBook.setId(rs.getInt("ID"));

eBook.setBname(rs.getString("bname"));

eBook.setPrice(rs.getString("price"));

list.add(eBook);

System.out.println(rs.getInt("ID")+rs.getString("bname")+rs.getString("price"));

}

}?catch?(SQLException?sqle)?{

sqle.printStackTrace();

}?finally?{

DBUtil.close(conn,?ps,?rs);

}

return?list;

}

/*

?*通過(guò)id刪除書(shū)集信息

?*?

?*?*/

public?static?EBook?DelById(int?id)?{

Connection?conn?=?null;

PreparedStatement?ps?=?null;

ResultSet?rs?=?null;

EBook?book?=?null;

try?{

conn?=?DBUtil.getConnection();

String?sql?=?"delete?ebook?";

sql?+=?"WHERE?ID=??";

ps?=?conn.prepareStatement(sql);

ps.setInt(1,?id);

rs?=?ps.executeQuery();

if?(rs.next())?{

book?=?new?EBook();

book.setId(rs.getInt("ID"));

book.setBname(rs.getString("bname"));

book.setPrice(rs.getString("price"));

}

}?catch?(SQLException?sqle)?{

sqle.printStackTrace();

}?finally?{

DBUtil.close(conn,?ps,?rs);

}

return?book;

}

}

package?EBookServlet;

import?java.io.IOException;

import?java.io.PrintWriter;

import?java.util.List;

import?javax.servlet.ServletException;

import?javax.servlet.http.HttpServlet;

import?javax.servlet.http.HttpServletRequest;

import?javax.servlet.http.HttpServletResponse;

import?DBUtil.EBook;

import?EBookDao.EBookCZ;

public?class?EBookServlet?extends?HttpServlet?{

/**

?*?

?*/

private?static?final?long?serialVersionUID?=?1L;

/**

?*?Constructor?of?the?object.

?*/

public?EBookServlet()?{

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?{

this.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=utf-8");

PrintWriter?out?=?response.getWriter();

String?method?=?request.getParameter("method");

String?url?=?"";

EBookCZ?bookCZ=new?EBookCZ();

?if?(method?!=?null??method.equals("find"))?{

?System.out.println("find做完了");

??url?=?"EBookMNG.jsp";

??ListEBook?list?=?bookCZ.find();

??request.setAttribute("list",?list);

}?else?if?(method?!=?null??method.equals("findById"))?{

?System.out.println("findbyid做完了");

??url?=?"OK.jsp";

??int?id?=?Integer.parseInt(request.getParameter("id"));

??EBook?book?=?EBookCZ.DelById(id);

??request.setAttribute("book",?book);

}

request.getRequestDispatcher(url).forward(request,?response);

out.flush();

out.close();

}

/**

?*?Initialization?of?the?servlet.?br

?*?

?*?@throws?ServletException

?*?????????????if?an?error?occurs

?*/

public?void?init()?throws?ServletException?{

//?Put?your?code?here

}

}


網(wǎng)站題目:網(wǎng)上書(shū)城java項(xiàng)目代碼,網(wǎng)上書(shū)城java項(xiàng)目代碼是多少
地址分享:http://weahome.cn/article/hchscd.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部