package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import bean.BookBean;
import dao.BookDao;
public class zhengjiaservlet extends HttpServlet {
/**
* Constructor of the object.
*/
public zhengjiaservlet() {
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 {
response.setContentType("text/html");
response.setCharacterEncoding("utf-8");
request.setCharacterEncoding("utf-8");
String bookid = new String(request.getParameter("bookid").getBytes("ISO8859_1"),"utf-8");
String bookname = new String(request.getParameter("bookname").getBytes("ISO8859_1"),"utf-8");
String publisher = new String(request.getParameter("publisher").getBytes("ISO8859_1"),"utf-8");
String author = new String(request.getParameter("author").getBytes("ISO8859_1"),"utf-8");
String price = new String(request.getParameter("price").getBytes("ISO8859_1"),"utf-8");
String publishDate = new String(request.getParameter("publishDate").getBytes("ISO8859_1"),"utf-8");
String count1 = new String(request.getParameter("count").getBytes("ISO8859_1"),"utf-8");
int count=Integer.parseInt(count1);
//System.out.print(user1+" "+pwd+" "+sex+" "+lever+" "+time);
BookBean user = new BookBean();
user.setBookid(bookid);
user.setBookname(bookname);
user.setPublisher(publisher);
user.setAuthor(author);
user.setPrice(price);
user.setPublishDate(publishDate);
user.setCount(count);
BookDao dao = new BookDao();
if(dao.Zhengjia(user))
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.print(" Successful£¡£¡£¡ ");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}
else
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.print(" Defeated!!! ");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}
}
/**
* 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");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.print(" This is ");
out.print(this.getClass());
out.println(", using the POST method");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
网上购物系统的后台管理(增、删、改、查图书)。
共49个文件
jsp:15个
java:12个
class:12个
5星 · 超过95%的资源 需积分: 50 237 下载量 55 浏览量
2013-05-02
22:45:59
上传
评论 6
收藏 428KB RAR 举报
温馨提示
综合运用JavaBean+JSP+Servlet+JDBC开发技术,实现网上购物系统的后台管理(增、删、改、查图书)。 编写程序实现如下功能: (实验三的任务)用户网上注册,注册信息写入数据库。 (实验四的任务)用户登陆后,进入网上购物系统,选择书籍,加入购物车,购物完毕进入结账界面(可模拟一下,简单输出一些信息);在用户购物的期间内,可随时查看购物车的状态,进入购物车后,也可返回再选择商品;在购物期间,用户也可以注销。 本次的任务:管理员以“admin”为用户名进行注册(或登录),对书籍进行后台管理(增、删、改、查)。
资源推荐
资源详情
资源评论
收起资源包目录
Shopping.rar (49个子文件)
Shopping
.project 1KB
.mymetadata 297B
src
tag
dao
UserDao.java 2KB
CartDao.java 119B
BookDao.java 4KB
backConnect.java 865B
BaseDao.java 696B
servlet
jianshaoservlet.java 3KB
zhengjiaservlet.java 4KB
gaizheng.java 4KB
bean
backConnectbean.java 704B
CartBean.java 931B
UserBean.java 870B
BookBean.java 1KB
WebRoot
registAccept.jsp 1KB
gaizheng.jsp 2KB
WEB-INF
classes
tag
dao
backConnect.class 2KB
BaseDao.class 1KB
BookDao.class 5KB
CartDao.class 392B
UserDao.class 3KB
servlet
zhengjiaservlet.class 3KB
gaizheng.class 3KB
jianshaoservlet.class 2KB
bean
UserBean.class 1KB
BookBean.class 2KB
CartBean.class 2KB
backConnectbean.class 1KB
lib
sqljdbc4.jar 413KB
web.xml 2KB
jianshao.jsp 1KB
logout.jsp 893B
loginAccept.jsp 1KB
regist.jsp 1KB
zhengjia.jsp 2KB
index.jsp 1KB
displayBook1.jsp 2KB
cart.jsp 3KB
displayBook.jsp 2KB
backLogin.jsp 2KB
META-INF
MANIFEST.MF 36B
BackManger.jsp 1KB
process.jsp 1KB
chaxun.jsp 2KB
.myeclipse
.settings
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.jdt.core.prefs 330B
org.eclipse.wst.jsdt.ui.superType.name 6B
.jsdtscope 500B
.classpath 433B
共 49 条
- 1
skyming
- 粉丝: 248
- 资源: 25
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页