一、源码特点
JSP 装饰公司网站是一套完善的web设计系统(系统采用serlvet mvc框架进行设计开发),对理解JSP java编程开发语言有帮助,系统具有完整的源代码
和数据库,系统主要采用B/S模式开发。
JSP SSH装饰公司网站myeclipse开发mysql
二、功能介绍
前台
首页
案例展示
关于我们
设计师介绍
公司信息
后台
(1)权限管理:对权限信息进行添加、删除、修改和查看
(2)用户管理:对用户信息进行添加、删除、修改和查看
(3)关于我们类别管理:对关于我们类别信息进行添加、删除、修改和查看
(4)关于我们管理:对关于我们信息进行添加、删除、修改和查看
(5)案例展示管理:对案例展示信息进行添加、删除、修改和查看
(6)信息类型管理:对信息类型信息进行添加、删除、修改和查看
(7)信息管理:对信息进行添加、删除、修改和查看
(8)设计师管理:对设计师信息进行添加、删除、修改和查看
(9)预约管理:对预约信息进行添加、删除、修改和查看
控制层代码
- 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 javax.servlet.http.HttpSession;
-
- import com.bean.xinxi;
- import com.dao.xinxiDao;
-
-
- import java.util.List;
- import java.sql.ResultSet;
-
- public class xinxiServlet extends HttpServlet {
- public void service(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- request.setCharacterEncoding("gb2312");
- System.out.println("method"+request.getParameter("method"));
- String method=(String)request.getParameter("method");
- if(method.equals("insert")){//信息添加
- insertM(request, response);
- }else if(method.equals("list")){//信息列表
- ListM(request, response);
- }else if(method.equals("delete")){//信息删除
- deleteM(request, response);
- }else if(method.equals("modifyindex")){//信息修改页面
- modifyIndex(request, response);
- }
- else if(method.equals("modify")){//信息修改
- modifyM(request, response);
- }else if(method.equals("detail")){//信息详细信息
- detailM(request, response);
- }else if(method.equals("Plist")){//信息列表信息
- PListM(request, response);
- }
- }
- private void insertM(HttpServletRequest request, HttpServletResponse response){//信息添加
- xinxiDao dao=new xinxiDao();
- xinxi xinxi=new xinxi();
- xinxi.setXxid((String)request.getParameter("keyid"));
- xinxi.setBt((String)request.getParameter("bt"));
- xinxi.setNr((String)request.getParameter("nr"));
- xinxi.setLx((String)request.getParameter("lx"));
- xinxi.setSj((String)request.getParameter("sj"));
-
- response.setCharacterEncoding("gb2312");
- try {
- dao.insert(xinxi);
- request.setAttribute("flag", "操作成功");
-
-
-
- request.getRequestDispatcher("xinxi/xinxiadd.jsp").forward(request, response);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
- private void ListM(HttpServletRequest request, HttpServletResponse response){//信息信息列表
- ResultSet rs=null;
- xinxiDao dao = new xinxiDao();
- System.out.println("alist");
-
- String sql="";
- response.setCharacterEncoding("gb2312");
- try{
- rs=dao.qlist(sql);
-
- PrintWriter out = response.getWriter();
- request.setAttribute("rs", rs);
-
-
- request.getRequestDispatcher("xinxi/xinxilist.jsp").forward(request, response);
- }catch(Exception e){
- e.toString();
- e.printStackTrace();
- }
-
- }
- private void PListM(HttpServletRequest request, HttpServletResponse response){//测试信息列表
- ResultSet rs=null;
- xinxiDao dao = new xinxiDao();
-
- String str=(String)request.getParameter("Page");
- String sql="";
- response.setCharacterEncoding("gb2312");
- try{
-
- if(str==null){
- str="0";
- }
- rs=dao.qlist(sql);
-
- PrintWriter out = response.getWriter();
- request.setAttribute("rs", rs);
-
-
- request.getRequestDispatcher("xinxi/xinxiPlist.jsp?Page=1").forward(request, response);
- }catch(Exception e){
- e.toString();
- e.printStackTrace();
- }
-
- }
- private void modifyIndex(HttpServletRequest request, HttpServletResponse response){//信息修改首页
- ResultSet rs=null;
- response.setCharacterEncoding("gb2312");
- xinxiDao dao = new xinxiDao();
-
-
- String keyid=(String)request.getParameter("keyid");
- String sql="";
-
-
- if(keyid!=null&&!keyid.equals("")){
-
- sql+=" and xxid='"+keyid+"'";
-
- }
- try{
- rs=dao.qlist(sql);
- PrintWriter out = response.getWriter();
- request.setAttribute("rs", rs);
-
- request.getRequestDispatcher("xinxi/xinximodify.jsp").forward(request, response);
- //response.sendRedirect("xinxi/xinximodify.jsp");
- }catch(Exception e){
- e.toString();
- e.printStackTrace();
- }
-
- }
- private void detailM(HttpServletRequest request, HttpServletResponse response){//信息详细信息页面
-
- ResultSet rs=null;
- response.setCharacterEncoding("gb2312");
- xinxiDao dao = new xinxiDao();
-
-
- String keyid=(String)request.getParameter("keyid");
- String sql="";
-
-
- if(keyid!=null&&!keyid.equals("")){
-
- sql+=" and xxid='"+keyid+"'";
-
- }
- try{
- rs=dao.qlist(sql);
-
- request.setAttribute("rs", rs);
- request.getRequestDispatcher("xinxi/xinxidetail.jsp").forward(request, response);
- }catch(Exception e){
- e.toString();
- e.printStackTrace();
- }
-
- }
- private void deleteM(HttpServletRequest request, HttpServletResponse response){//信息删除
- ResultSet lst=null;
- xinxiDao dao = new xinxiDao();
- response.setCharacterEncoding("gb2312");
- String keyid=(String)request.getParameter("keyid");
-
- try{
- dao.delete(keyid);
- request.setAttribute("flag", "删除成功");
- request.getRequestDispatcher("xinxiServlet?method=list").forward(request, response);
-
- //response.sendRedirect("xinxiServlet?method=list");
- }catch(Exception e){
- e.toString();
- e.printStackTrace();
- }
-
- }
-
- private void modifyM(HttpServletRequest request, HttpServletResponse response){//信息修改功能
- xinxiDao dao=new xinxiDao();
- xinxi xinxi=new xinxi();
- xinxi.setXxid((String)request.getParameter("keyid"));
- xinxi.setBt((String)request.getParameter("bt"));
- xinxi.setNr((String)request.getParameter("nr"));
- xinxi.setLx((String)request.getParameter("lx"));
- xinxi.setSj((String)request.getParameter("sj"));
-
- response.setCharacterEncoding("gb2312");
- try {
- dao.modify(xinxi);
- PrintWriter out = response.getWriter();
-
- request.setAttribute("flag", "操作成功");
- request.getRequestDispatcher("xinxiServlet?method=list").forward(request, response);
-
- //response.sendRedirect("xinxiServlet?method=list");
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
- }
dao层代码
- package com.dao;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
-
-
-
-
- import com.bean.xinxi;
- import com.util.DBO;
- import java.util.List;
- import java.sql.ResultSet;
- public class xinxiDao {
- private DBO db=null;//
- private xinxi xinxi=null;
- public void insert(xinxi xinxi) throws Exception{//添加信息
- db=new DBO();
- db.open();
-
- String sql = "insert into xinxi (bt,nr,lx,sj ) values ('"+xinxi.getBt()+"','"+xinxi.getNr()+"','"+xinxi.getLx()+"','"+xinxi.getSj()+"')";
-
-
- db.update(sql);
- //db.commit();
- db.close();
-
- }
- public void modify(xinxi xinxi) throws Exception{//修改信息
- db=new DBO();
- db.open();
-
- String sql = "update xinxi set bt='"+xinxi.getBt()+"',nr='"+xinxi.getNr()+"',lx='"+xinxi.getLx()+"',sj='"+xinxi.getSj()+"' where xxid ='"+xinxi.getXxid()+"'";
-
-
- db.update(sql);
- //db.commit();
- db.close();
-
- }
- public void delete(String keyid) throws Exception{//删除信息
- db=new DBO();
- db.open();
-
- String sql = "delete from xinxi where xxid='"+keyid+"'";
-
-
- db.update(sql);
- //db.commit();
- db.close();
-
- }
- public ResultSet qlist(String sl) throws Exception{//查询信息
- db=new DBO();
- db.open();
- String sql="select * from xinxi where 1=1 ";
- if(!sl.equals("")){
- sql+=sl;
-
- }
- System.out.println("sql="+sql);
- return db.query(sql);
-
- }
- }
bean
- package com.bean;
-
-
-
- public class xinxi {
-
-
-
- private String xxid="";//信息编号
-
- private String bt="";//标题
-
- private String nr="";//内容
-
- private String lx="";//类型
-
- private String sj="";//时间
-
-
-
-
-
- public String getXxid(){
- return xxid;
- }
-
- public void setXxid(String xxid){
- this.xxid = xxid;
- }
-
- public String getBt(){
- return bt;
- }
-
- public void setBt(String bt){
- this.bt = bt;
- }
-
- public String getNr(){
- return nr;
- }
-
- public void setNr(String nr){
- this.nr = nr;
- }
-
- public String getLx(){
- return lx;
- }
-
- public void setLx(String lx){
- this.lx = lx;
- }
-
- public String getSj(){
- return sj;
- }
-
- public void setSj(String sj){
- this.sj = sj;
- }
-
-
-
-
-
-
-
- }
-
三、注意事项
1、管理员账号:admin 密码:admin 数据库配置文件DBO。java
2、开发环境为TOMCAT7.0,Myeclipse8.5开发,数据库为Mysql5.0,使用java语言
3、数据库文件名是jspfzhuangshi.mdf,系统名称zhuangshi
4、系统首页地址:http://127.0.0.1:8080/zhuangshi/