网上书城java源代码 javaweb网上书城源码
java:哪里能看到JDK的源代码?
你安装JDK的目录下,有个src.zip文件,这个就是JDK源代码的java文件。
创新互联专注于企业成都全网营销、网站重做改版、灵寿网站定制设计、自适应品牌网站建设、H5网站设计、商城系统网站开发、集团公司官网建设、成都外贸网站制作、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为灵寿等各大城市提供网站开发制作服务。
你可以解压来查看,但,最好是关联到IDE如 eclipse 中(不需解压),然后 CTRL + 点击就可以查看到源代码了。
如下图:
java 实现在线书店基本功能的实现
记得SPRING2.0技术手册里有该项目开发示例
你搜索一下SPRING
2.0技术手册
CD光盘
或者
源码
某网上书城可以查询、删除书籍,现要求使用JSP实现该功能
简单的增删改查功能
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;
/*
*查询书集信息
*
* */
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;
}
/*
*通过id删除书集信息
*
* */
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
}
}
当前名称:网上书城java源代码 javaweb网上书城源码
文章链接:http://ybzwz.com/article/dogdgse.html