• 大小: 933KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-16
  • 语言: Java
  • 标签: servlet  javabean  MySQL  

资源简介

一个基于servlet javabean MySQL的商品网站,适合初学者

资源截图

代码片段和文件信息

package wyf.hxl;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class CustomerServlet extends HttpServlet
{
public void doGet(HttpServletRequest requestHttpServletResponse response)
throws ServletExceptionIOException
{
this.doPost(requestresponse);
}
public void doPost(HttpServletRequest requestHttpServletResponse response)
throws ServletExceptionIOException
{
request.setCharacterEncoding(“GB2312“);
response.setCharacterEncoding(“GB2312“);
response.setContentType(“text/html;charset=GB2312“);
HttpSession session=request.getSession(true);
PrintWriter out=response.getWriter();
PaginationBean handlePage = (PaginationBean)session.getAttribute(“handlePage“);
if(handlePage==null){
handlePage = new PaginationBean();
session.setAttribute(“handlePage“handlePage);
}
String action=request.getParameter(“action“);
if(action==null){return;}
if(action.equals(“denglu“))
{
String zname = request.getParameter(“zname“);
String zpassword = request.getParameter(“zpassword“);
String cname = new String(zname.getBytes()“ISO-8859-1“);
String sql = “select cname from gcustomer where cname=‘“+cname+“‘ and cpw=‘“+zpassword+“‘“;
boolean s = DB.selectMsg(sql);
if(s)
{
session.setAttribute(“user“zname);
String fromWhere=(String)session.getAttribute(“fromWhere“);
if(fromWhere!=null)
{
if(fromWhere.equals(“jz“))
{//回结账
this.getServletContext().getRequestDispatcher(“/CustomerServlet?action=jiezhang“).forward(requestresponse);
return;
}
else if(fromWhere.equals(“wddd“))
{//回我的订单
this.getServletContext().getRequestDispatcher(“/CustomerServlet?action=modify2“).forward(requestresponse);
return;
}
else if(fromWhere.equals(“mmcz“))
{//回密码重置
this.getServletContext().getRequestDispatcher(“/customerpwchange.jsp“).forward(requestresponse);
return;
}
}
this.getServletContext().getRequestDispatcher(“/pagination.jsp“).forward(requestresponse);
}
    else
    {
   String msg = “对不起登录失败请重新登录!!!“;
   request.setAttribute(“msg“msg);
   this.getServletContext().getRequestDispatcher(“/customermanage.jsp“).forward(requestresponse);
    }
}
else if(action.equals(“zhuce“)){
String zname = request.getParameter(“cname“);
String zpassword = request.getParameter(“cpassword“);
String spw = request.getParameter(“spw“);
String email = request.getParameter(“email“);
String cname = new String(zname.getBytes()“ISO-8859-1“);
String cpw = new String(zpassword.getBytes()“ISO-8859-1“);
String cemail = new String(email.getBytes()“ISO-8859-1“);
String sql = “select cname from gcustomer where cname=‘“+cname+“‘“;
boolean s = DB.selectMsg(sql);
if(s)
{
String msg =“网络有重名,请重新注册!!“;
request.setAttribute(“msg“msg);
this

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-01-19 22:45  chaoshi\
     文件        1622  2014-11-19 17:25  chaoshi\.classpath
     目录           0  2011-09-19 19:01  chaoshi\.myeclipse\
     文件         295  2011-07-24 00:03  chaoshi\.mymetadata
     文件        1617  2014-11-19 17:25  chaoshi\.project
     目录           0  2015-01-19 22:45  chaoshi\.settings\
     文件         522  2014-11-19 17:25  chaoshi\.settings\.jsdtscope
     文件         105  2011-07-24 00:07  chaoshi\.settings\com.genuitec.eclipse.core.prefs
     文件        1040  2011-07-19 08:45  chaoshi\.settings\com.genuitec.eclipse.j2eedt.core.prefs
     文件         423  2014-11-19 17:25  chaoshi\.settings\com.genuitec.eclipse.migration.prefs
     文件         364  2014-11-19 17:25  chaoshi\.settings\org.eclipse.jdt.core.prefs
     文件         547  2014-11-19 17:25  chaoshi\.settings\org.eclipse.wst.common.component
     文件         412  2014-11-19 17:25  chaoshi\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2014-11-19 17:25  chaoshi\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2014-11-19 17:25  chaoshi\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2015-01-19 22:45  chaoshi\src\
     目录           0  2015-01-19 22:45  chaoshi\src\meta-INF\
     文件          40  2014-11-19 17:25  chaoshi\src\meta-INF\MANIFEST.MF
     目录           0  2015-01-19 22:45  chaoshi\src\wyf\
     目录           0  2015-01-19 22:45  chaoshi\src\wyf\hxl\
     文件       26470  2011-06-26 21:36  chaoshi\src\wyf\hxl\CustomerServlet.java
     文件       11072  2011-07-19 08:56  chaoshi\src\wyf\hxl\DB.java
     文件         810  2011-06-26 21:36  chaoshi\src\wyf\hxl\ManageBean.java
     文件       23984  2011-07-24 00:39  chaoshi\src\wyf\hxl\ManageServlet.java
     文件        2307  2011-06-26 21:36  chaoshi\src\wyf\hxl\PaginationBean.java
     目录           0  2015-01-19 22:45  chaoshi\WebRoot\
     文件         227  2011-06-26 21:36  chaoshi\WebRoot\admindl.jsp
     文件         552  2011-06-26 21:36  chaoshi\WebRoot\almintop.jsp
     文件        3647  2011-06-26 21:36  chaoshi\WebRoot\cart.jsp
     文件        4820  2011-06-26 21:36  chaoshi\WebRoot\customerdd.jsp
     文件        6223  2011-07-24 00:05  chaoshi\WebRoot\customerddxiugai.jsp
............此处省略159个文件信息

评论

共有 条评论