10054基于SSH开发的宠物商城
代码
鏈-椄:https://pan@baidu@com/s/1XOWsGxmhBd03TlrzSAYxqQ (把@换成 . 就可正常访问)
趧-紶-碼:1022
f/u枝此段-吶傛打开baidu網盤手机App,caozuo更方便哦
技术
Spring + Struts + Hibernate
工具
eclipse + tomact + mysql + jdk
功能详情
前台功能 | 后台功能 |
---|---|
首页 | 商品管理 |
狗狗商城 | 新闻资讯管理 |
狗狗资料 | 焦点图管理 |
购物车 | 友情链接管理 |
在线留言 | 在线留言管理 |
关于我们 | 会员评论管理 |
用户登录 | 网站导航管理 |
用户注册 | 用户管理 |
系统后台 |
系统相关截图
● 系统首页
● 后台首页
package com.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.daoImpl.EmploeDaoImpl;
import com.entity.Emploe;
import com.entity.Manager;
public class EmploeRemove extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String eid = request.getParameter(“eid”);
EmploeDaoImpl edi = new EmploeDaoImpl();
boolean flag = edi.remove(Integer.parseInt(eid));
if(flag){
response.sendRedirect(“EmploeTable”);
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}
package com.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.daoImpl.DeptDaoImpl;
import com.daoImpl.PostDaoImpl;
import com.entity.Dept;
import com.entity.Post;
public class EmploeShowSelf extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
DeptDaoImpl ddi = new DeptDaoImpl();
ArrayList<Dept> deptList = ddi.getAllDept();
request.getSession().setAttribute("deptList", deptList);
PostDaoImpl pdi = new PostDaoImpl();
ArrayList<Post> postList = pdi.getAllPost();
request.getSession().setAttribute("postList", postList);
response.sendRedirect("emploe/show_self.jsp");
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}
package com.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.daoImpl.DeptDaoImpl;
import com.daoImpl.EmploeDaoImpl;
import com.entity.Dept;
import com.entity.Emploe;
import com.entity.Manager;
public class EmploeTable extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
EmploeDaoImpl edi = new EmploeDaoImpl();
String pageNow =request.getParameter("n");
if(pageNow==null||pageNow.equals("")){
pageNow="1";
}
if(Integer.parseInt(pageNow)<1){
pageNow="1";
}
int pageCount =1;
if(request.getSession().getAttribute("pageCount")!=null&&!request.getSession().getAttribute("pageCount").equals("")){
pageCount =(Integer)request.getSession().getAttribute("pageCount");
}
if(Integer.parseInt(pageNow)>pageCount){
pageNow = pageCount+"";
}
ArrayList<Emploe> listByPage = edi.getAllEmploeByPage(Integer.parseInt(pageNow));
request.getSession().setAttribute("listByPage", listByPage);
DeptDaoImpl ddi = new DeptDaoImpl();
ArrayList<Dept> deptList =ddi.getAllDept();
request.getSession().setAttribute("deptList", deptList);
pageCount =edi.getPageCount();
request.getSession().setAttribute("pageCount", pageCount);
System.out.println(pageNow);
request.getSession().setAttribute("pageNow", pageNow);
int lineCount =edi.getLineCount();
request.getSession().setAttribute("lineCount", lineCount);
String mname = (String)request.getSession().getAttribute("mname");
Manager manager = (Manager)request.getSession().getAttribute("manager");
response.sendRedirect("manager/emploe_table.jsp");
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}
package com.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 com.daoImpl.EmploeDaoImpl;
import com.entity.Emploe;
public class EmploeUpdatePhoto extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String ephoto = request.getParameter("img");
System.out.println(ephoto);
EmploeDaoImpl edi = new EmploeDaoImpl();
Emploe emploe =(Emploe)request.getSession().getAttribute("emploe");
if(ephoto!=null&&!ephoto.equals("")){
emploe.setEphoto(ephoto);
boolean flag = edi.updateEmploe(emploe.getEid(), emploe);
if(flag){
request.getSession().setAttribute("emploe", emploe);
response.sendRedirect("emploe/show_self.jsp");
}else{
response.sendRedirect("emploe/showImage.jsp");
}
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}
package com.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.daoImpl.DeptDaoImpl;
import com.daoImpl.EmploeDaoImpl;
import com.daoImpl.PostDaoImpl;
import com.entity.Dept;
import com.entity.Emploe;
import com.entity.Post;
public class EmploeUpdateSelf extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String eid = request.getParameter("eid");
String ename = request.getParameter("ename");
String esalary = request.getParameter("esalary");
String esex = request.getParameter("esex");
String ebir = request.getParameter("ebir");
String emarry = request.getParameter("emarry");
String eedu = request.getParameter("eedu");
String did = request.getParameter("did");
DeptDaoImpl ddi = new DeptDaoImpl();
Dept dept = ddi.getDeptById(Integer.parseInt(did));
request.getSession().setAttribute("dept", dept);
String pid = request.getParameter("pid");
PostDaoImpl pdi = new PostDaoImpl();
Post post = pdi.getPostById(Integer.parseInt(pid));
request.getSession().setAttribute("post", post);
String ephone = request.getParameter("ephone");
String eaddr = request.getParameter("eaddr");
String equestion = request.getParameter("equestion");
String eanswer = request.getParameter("eanswer");
Emploe emploe = (Emploe)request.getSession().getAttribute("emploe");
emploe.setEid(Integer.parseInt(eid));
emploe.setEname(ename);
emploe.setEsalary(esalary);
emploe.setEsex(esex);
SimpleDateFormat sfd = new SimpleDateFormat("yyyy-MM-dd");
try {
emploe.setEbir(sfd.parse(ebir));
} catch (ParseException e) {
e.printStackTrace();
}
emploe.setEmarry(emarry);
emploe.setEedu(eedu);
emploe.setDid(Integer.parseInt(did));
emploe.setPid(Integer.parseInt(pid));
emploe.setEphone(ephone);
emploe.setEaddr(eaddr);
emploe.setEquestion(equestion);
emploe.setEanswer(eanswer);
EmploeDaoImpl edi = new EmploeDaoImpl();
boolean flag = edi.updateEmploe(Integer.parseInt(eid), emploe);
if(flag){
request.getSession().setAttribute("username", ename);
request.getSession().setAttribute("emploe", emploe);
response.sendRedirect("emploe/show_self.jsp");
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}
package com.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 com.daoImpl.EmploeDaoImpl;
import com.entity.Emploe;
public class FindPassword extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String eid = request.getParameter("eid");
String equestion= request.getParameter("equestion");
String eanswer = request.getParameter("eanswer");
EmploeDaoImpl edi = new EmploeDaoImpl();
Emploe emploe = edi.getEmploeById(Integer.parseInt(eid));
if(emploe!=null){
if(equestion.equals(emploe.getEquestion())&&eanswer.equals(emploe.getEanswer())){
request.getSession().setAttribute("emploe", emploe);
response.sendRedirect("failure.jsp?log=epassword");
}else{
response.sendRedirect("findpassword.jsp");
}
}else{
response.sendRedirect("findpassword.jsp");
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}
package com.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 com.daoImpl.EmploeDaoImpl;
import com.entity.Emploe;
public class InitPassword extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Emploe emploe = (Emploe)request.getSession().getAttribute("emploe");
emploe.setEpassword(emploe.getEid()+"");
EmploeDaoImpl edi = new EmploeDaoImpl();
PrintWriter out = response.getWriter();
boolean flag = edi.updateEmploe(emploe.getEid(), emploe);
if(flag){
out.print("<font color='green'>¡Ì</font>");
request.getSession().setAttribute("emploe", emploe);
response.sendRedirect("EmploeDetail?eid="+emploe.getEid());
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}
package com.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.daoImpl.DeptDaoImpl;
import com.daoImpl.EmploeDaoImpl;
import com.daoImpl.PostDaoImpl;
import com.entity.Dept;
import com.entity.Emploe;
import com.entity.Post;
public class Login extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String eid = request.getParameter("username");
String epassword = request.getParameter("password");
String cookie = request.getParameter("autologin");
if(cookie.equals("auto")&&cookie!=null){
Cookie c1 = new Cookie("username",eid);
Cookie c2 = new Cookie("password",epassword);
c1.setMaxAge(60*60*24);
c2.setMaxAge(60*60*24);
response.addCookie(c1);
response.addCookie(c2);
}
EmploeDaoImpl edi =new EmploeDaoImpl();
int n =edi.emploeLogin(Integer.parseInt(eid), epassword);
Emploe emploe = edi.getEmploeById(Integer.parseInt(eid));
if(n==1){
DeptDaoImpl ddi = new DeptDaoImpl();
ArrayList<Dept> deptList = ddi.getAllDept();
request.getSession().setAttribute("deptList", deptList);
PostDaoImpl pdi = new PostDaoImpl();
ArrayList<Post> postList = pdi.getAllPost();
request.getSession().setAttribute("postList", postList);
request.getSession().setAttribute("emploe",emploe);
response.sendRedirect("EmploeShowSelf");
}else if(n==2){
response.sendRedirect("login.jsp");
}else {
response.sendRedirect("login.jsp");
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}
package com.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 com.daoImpl.MessageDaoImpl;
import com.entity.Message;
public class ManagerDeleteNews extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String mid = request.getParameter(“mid”);
MessageDaoImpl mdi = new MessageDaoImpl();
boolean flag = mdi.deleteNews(Integer.parseInt(mid));
System.out.println(flag);
if(flag){
response.sendRedirect(“NewsTable”);
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}