基于javaweb+mysql的ssm在线相机商城系统(java+ssm+jsp+jquery+mysql)

基于javaweb+mysql的ssm在线相机商城系统(java+ssm+jsp+jquery+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb+mysql的SSM在线相机商城系统(java+ssm+jsp+jquery+mysql)

项目介绍

分为两个角色,一个管理员,一个普通用户 管理员角色包含以下功能: 管理员登录,相机品牌管理,相机库存管理,相机商品管理,相机订单管理,相机售后管理,新闻资讯管理,物流管理等功能。 用户角色包含以下功能: 商城首页,查看详情评论商品,用户注册后登录,查看购物车,按分类查看商品,提交订单,选择地址支付页面,查看订单,查看收藏,申请售后,留言等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 6.数据库:MySql 5.7等版本均可;

技术栈

  1. 后端:Spring springmvc mybatis 2. 前端:JSP+css+javascript+jQuery

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2.使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat
		}
		return "zycar";
		}else{
	    return "redirect:productDetails.do?id="+id+"&msg=msg";
		}
	}

    /**
     * Product edit string.
     *
     * @param product the product
     * @param request the request
     * @return the string
     */
//相机编辑
	@RequestMapping("/admin/productEdit")
	public String productEdit(Product product,HttpServletRequest request){
		productDAO.update(product);
		request.setAttribute("product", product);
		return "redirect:productMsg.do";
	}

    /**
     * Fubi edit string.
     *
     * @param product the product
     * @param request the request
     * @return the string
     */
    @RequestMapping("/admin/fubiEdit")
	public String fubiEdit(Product product,HttpServletRequest request){
		productDAO.update(product);
		request.setAttribute("product", product);
		return "redirect:fubiList.do";
	}

    /**
     * Fdproduct all string.
     *
     * @param id      the id
     * @param request the request
     * @return the string
     */
//相机删除
	@RequestMapping("admin/fdproductAll")
	public String fdproductAll(int id,HttpServletRequest request){
			productDAO.delete(id);
		return "redirect:productMsg.do";
	}

    /**
			ordermsg.setFkstatus("已付款");
			ordermsg.setTotal(doublesjtotal);
			
			String fktime = Info.getDateStr();
//			try {
//				if(Info.compare(fktime,fktime.substring(0, 10)+" 18:00:00")){
//					ordermsg.setRemark("当日达");
//				}else{
//					ordermsg.setRemark("次日达");
//				}
//			} catch (ParseException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			}
			ordermsgDAO.update(ordermsg);
			request.setAttribute("ordermsg", ordermsg);
			if(ticketid!=null&&!ticketid.equals("")){
			ticketDAO.delete(Integer.parseInt(ticketid));
			}
			
			//mmm.setMoney(sxyue);
			//memberDAO.updateYue(mmm);
			
			double xftotal = mmm.getXftotal()+doublesjtotal;
			mmm.setXftotal(xftotal);
			memberDAO.updateXftotal(mmm);
			
			int jf = mmm.getJf()+new Double(doublesjtotal).intValue();
			mmm.setJf(jf);
			memberDAO.updateJf(mmm);
			
//			if(!mmm.getCardtype().equals("白金卡")){
//			if(xftotal>300&&xftotal<800){
//				mmm.setCardtype("银卡");
//			}else if(xftotal>800&&xftotal<1500){
//				mmm.setCardtype("金卡");
//			}else if(xftotal>1500){
//				mmm.setCardtype("白金卡");
//			}
//			}
			memberDAO.update(mmm);
			saveobject.getCategoryObject(request);

/**
 * The type Member controller.
 */
@Controller
public class MemberController extends BaseController {
    /**
     * The Member dao.
     */
    @Resource
	MemberDAO memberDAO;
    /**
     * The Category dao.
     */
    @Resource
	CategoryDAO categoryDAO;
    /**
     * The User dao.
     */
    @Resource
	UserDAO userDAO;
    /**
     * The Saveobject.
     */
    @Resource
	Saveobject saveobject;

    /**
     * Login string.
     *
     * @param uname   the uname
     * @param upass   the upass
     * @param request the request
     * @return the string
     */
//登录
	@RequestMapping("Login")
	public String Login(String uname,String upass, HttpServletRequest request){
		HashMap map = new HashMap();
		map.put("uname", uname);
		map.put("upass", MD5.getDigest(upass));
		List<Member> list = memberDAO.selectAll(map);
		if(list.size()==0){
			return "redirect:skipLogin.do?suc=suc";
		}else{
			request.getSession().setAttribute("sessionmember", list.get(0));
			return "redirect:index.do";	
		}
	}
	}

	
	
}
package com.util;

/**
 * The type Comm dao.
 */
public class CommDAO {

    /**
     * The constant conn.
     */
    public static Connection conn = null;

    /**
     * Instantiates a new Comm dao.
     */
    public CommDAO() {
        conn = this.getConn();
    }

    /**
     *
     * @param id      the id
     * @param request the request
     * @return the string
     */
//删除留言
	@RequestMapping("/admin/messageDel")
	public String messageDel(int id,HttpServletRequest request) {
		messageDAO.delete(id);
		return "redirect:messageList.do";
	}

}
package com.controller;

 

		HashMap map = new HashMap();
		map.put("key", key);
		List<Message> list = messageDAO.selectAll(map);
		for(int i=0;i<list.size();i++){
			Member m = memberDAO.findById(list.get(i).getMemberid());
			list.get(i).setMember(m);
		}
		PageInfo<Message> pageInfo =  new PageInfo<Message>(list);
		request.setAttribute("pageInfo", pageInfo);
		request.setAttribute("key", key);
		return "admin/messagelist";
	}

    /**
     * Search message string.
     *
     * @param key     the key
     * @param request the request
     * @return the string
     */
//后台搜索留言
	@RequestMapping("/admin/searchMessage")
	public String searchMessage(String key, HttpServletRequest request) {
		String index = request.getParameter("index");
	   	int pageindex = 1;
	   	if(index!=null){
	   		 pageindex = Integer.parseInt(index);
	   	}
   	    Page<Object> page = PageHelper.startPage(pageindex,6);
		List<Message> list = messageDAO.searchMessage(key);
		for(int i=0;i<list.size();i++){
			Member m = memberDAO.findById(list.get(i).getMemberid());
			list.get(i).setMember(m);
		}
		request.setAttribute("list", list);
		request.setAttribute("key", key);
		request.setAttribute("index", page.getPageNum());
		request.setAttribute("pages", page.getPages());
		request.setAttribute("total", page.getTotal());
		return "admin/messagesearchlist";
            e.printStackTrace();
        }
        return hournum;
    }

    /**
     * Del html tag string.
     *
     * @param htmlStr the html str
     * @return the string
     */
    public static String delHTMLTag(String htmlStr) {
        String regEx_script = "<script[^>]*?>[\\s\\S]*?<\\/script>"; //定义script的正则表达式
        String regEx_style = "<style[^>]*?>[\\s\\S]*?<\\/style>"; //定义style的正则表达式
        String regEx_html = "<[^>]+>"; //定义HTML标签的正则表达式

        Pattern p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
        Matcher m_script = p_script.matcher(htmlStr);
        htmlStr = m_script.replaceAll(""); //过滤

        Pattern p_style = Pattern.compile(regEx_style, Pattern.CASE_INSENSITIVE);
        Matcher m_style = p_style.matcher(htmlStr);
        htmlStr = m_style.replaceAll(""); //过滤style标签

        Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
        Matcher m_html = p_html.matcher(htmlStr);
        htmlStr = m_html.replaceAll(""); //过滤html标签

        return htmlStr.trim(); //返回文本字符串
    }

//	    public static void main(String[] args) {
//			System.out.println(a);
//		}

    /**
     * Compare boolean.
     *
     * @param time1 the time 1
     * @param time2 the time 2
     * @return the boolean
     * @throws ParseException the parse exception
     */
    public static boolean compare(String time1, String time2) throws ParseException {
        //如果想比较日期则写成"yyyy-MM-dd"就可以了
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        //将字符串形式的时间转化为Date类型的时间
     * @return the string
     */
//删除入驻申请
	@RequestMapping("admin/applySc")
	public String applySc(int id, HttpServletRequest request,HttpServletResponse response){
		applyDAO.delete(id);
		return "redirect:applyLb.do";
	}
	
	
	
	
	
	

}
package com.controller;

 

	}

    /**
     * Show user string.
     *
     * @param id      the id
     * @param request the request
     * @return the string
     */
    @RequestMapping("/admin/showUser")
	public String showUser(int id, HttpServletRequest request){
		User user = userDAO.findById(id);
		request.setAttribute("user", user);
		return "admin/useredit";
	}

    /**
     * User edit string.
     *
     * @param u       the u
     * @param request the request
     * @return the string
     */
    @RequestMapping("/admin/userEdit")
	public String userEdit(User u, HttpServletRequest request){
		userDAO.update(u);
		return "redirect:userList.do";
	}

    /**
     * User del string.
     *
     * @param id      the id
     * @param request the request
     * @return the string
     */
    @RequestMapping("/admin/userDel")
	public String userDel(int id,HttpServletRequest request){
		User user = userDAO.findById(id);
		user.setDelstatus("1");
		userDAO.update(user);
		return "redirect:userList.do";
	}
     * @param id      the id
     * @param request the request
     * @return the string
     */
//相机删除
	@RequestMapping("admin/fdproductAll")
	public String fdproductAll(int id,HttpServletRequest request){
			productDAO.delete(id);
		return "redirect:productMsg.do";
	}

    /**
     * Product del all string.
     *
     * @param id       the id
     * @param request  the request
     * @param response the response
     * @return the string
     */
//相机删除
	@RequestMapping("admin/productDelAll")
	public String productDelAll(int id,HttpServletRequest request,HttpServletResponse response){
			productDAO.delete(id);
		return "redirect:productList.do";
	}

    /**
     * Fubi del string.
     *
     * @param id       the id
     * @param request  the request
     * @param response the response
     * @return the string
     */
    @RequestMapping("admin/fubiDel")
	public String fubiDel(int id,HttpServletRequest request,HttpServletResponse response){
		productDAO.delete(id);
		return "redirect:fubiList.do";
	}

    /**
     * Product lb string.
     *
     * @param pageNum the page num
     * @param request the request
     * @return the string
     */
//显示相机列表页
	@RequestMapping("productLb")
	public String productLb(@RequestParam(defaultValue = "1",value = "pageNum") Integer pageNum,HttpServletRequest request){
		String fid = request.getParameter("fid");
			try {
				out = response.getWriter();
				String id = request.getParameter("id");
				String ordermsgid = request.getParameter("ordermsgid");
				Ticket ticket = ticketDAO.findById(Integer.parseInt(id));
				Ordermsg ordermsg = ordermsgDAO.findById(Integer.parseInt(ordermsgid));
				int money = ticket.getMoney();
				saveobject.getCart(request);
				double total = (Double)ordermsg.getTotal();
//				if(total<99){
//					total=total+12;
//				}
				if(total>money){
					double yhtotal = total-money;
					String yhtotalstr = String.format("%.2f", yhtotal);
					out.println(yhtotalstr);
				}else{
					out.println("-1");
				}
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

    /**
     * Skip zffs string.
     *
     * @param request the request
     * @return the string
     */
//支付方式页面
	@RequestMapping("skipZffs")
	public String skipZffs(HttpServletRequest request){
		Member member = (Member)request.getSession().getAttribute("sessionmember");
		String suc = request.getParameter("suc")==null?"":request.getParameter("suc");
		String id = request.getParameter("id");
		String totalstr = request.getParameter("totalstr");
		String ticketid = request.getParameter("ticketid");
		String addrid = request.getParameter("addrid");
		request.setAttribute("id", id);
		request.setAttribute("id", id);
		request.setAttribute("sjtotal", totalstr);
		request.setAttribute("ticketid", ticketid);
		request.setAttribute("addrid", addrid);
		saveobject.getCategoryObject(request);
		
		
		return "zffs";
	}

    /**
     * Fukuan string.
     *
     * @param request the request
     * @return the string
     */
//订单付款
	@RequestMapping("fukuan")
	public String fukuan(HttpServletRequest request){
		Member member = (Member)request.getSession().getAttribute("sessionmember");
		Member mmm = memberDAO.findById(member.getId());
		String id = request.getParameter("id");
		String sjtotal = request.getParameter("sjtotal");
		String ticketid = request.getParameter("ticketid");
		String addrid = request.getParameter("addrid");
		String zffs = request.getParameter("zffs");
		String shfs = request.getParameter("shfs");
		//double yue = mmm.getMoney();
		//查优惠券
		
		
		double doublesjtotal = Double.parseDouble(sjtotal);
		if(ticketid != null && !ticketid.equals("")){
			Ticket ticket = ticketDAO.findById(Integer.valueOf(ticketid));
			doublesjtotal = doublesjtotal - Double.valueOf(ticket.getMoney());
		}
		//boolean flag = true;
		//double sxyue = yue-doublesjtotal;

		//if(sxyue>=0){
		
			Ordermsg ordermsg = ordermsgDAO.findById(Integer.parseInt(id));
			

			Address address = addressDAO.findById(Integer.parseInt(addrid));
			ordermsg.setAddress(address);
			HashMap map1 = new HashMap();
			map1.put("ddno", ordermsg.getDdno());
			List<Ordermsgdetails> dddetailist = ordermsgdetailsDAO.selectAll(map1);
			for(Ordermsgdetails orderdetail:dddetailist){
        int j = 0;
        if(s == null)
        {
            throw new IllegalArgumentException("There is no specified destination file (1025).");
        }
        if(s.length() == 0)
        {
            throw new IllegalArgumentException("There is no specified destination file (1025).");
        }
        if(!isVirtual(s) && m_denyPhysicalPath)
        {
            throw new SecurityException("Physical path is denied (1035).");
        }
        i = m_request.getContentLength();
        m_binArray = new byte[i];
        int k;
        for(;j < i;j += k)
        {
            try
            {
                k = m_request.getInputStream().read(m_binArray,j,i - j);
            }
            catch(Exception exception)
            {
                throw new SmartUploadException("Unable to upload.");
            }
        }

        if(isVirtual(s))
        {
            s = m_application.getRealPath(s);
        }
        try
        {
            java.io.File file = new java.io.File(s);
            FileOutputStream fileoutputstream = new FileOutputStream(file);
            fileoutputstream.write(m_binArray);
            fileoutputstream.close();
        }
        catch(Exception exception1)
        {
            throw new SmartUploadException("The Form cannot be saved in the specified file (1030).");
        }
    }

    private boolean isVirtual(String s)
     * Gets .
     *
     * @param name      the name
     * @param tablename the tablename
     * @param zdname    the zdname
     * @param where     the where
     * @return the
     */
    public static String getcheckbox(String name, String tablename, String zdname, String where) {
        String checkbox = "";
        for (HashMap permap : new CommDAO().select("select * from " + tablename + " where " + where + " order by id desc")) {

            String optionstr = "";
            for (String str : zdname.split(";")) {
                String zdstr = str.split("~")[0];
                String zdnamestr = str.split("~")[1].equals("无名") ? "" : (str.split("~")[1] + ":");
                optionstr += zdnamestr + permap.get(zdstr) + " - ";
            }
            if (optionstr.length() > 0) optionstr = optionstr.substring(0, optionstr.length() - 3);

            checkbox += "<label><input type='checkbox' name='" + name + "' value=\"" + optionstr + "\">" + optionstr + "</label>\n";
        }
        checkbox += "<input type=hidden name='" + name + "' value='' />";
        return checkbox;
    }

    /**
     * Gets dk.
     *
     * @param name      the name
     * @param tablename the tablename
     * @param zdname    the zdname
     * @param nstr      the nstr
     * @param where     the where
     * @return the dk
     */
    public static String getcheckboxDk(String name, String tablename, String zdname, String nstr, String where) {
        String checkbox = "";
        int i = 0;
        for (HashMap permap : new CommDAO().select("select * from " + tablename + " where " + where + " order by id desc")) {

            String optionstr = "";
            for (String str : zdname.split(";")) {
                String zdstr = str.split("~")[0];
                String zdnamestr = str.split("~")[1].equals("无名") ? "" : (str.split("~")[1] + ":");
                optionstr += zdnamestr + permap.get(zdstr) + " - ";
            }

                    jscode += "if(document.getElementById(\"txt5\"))\n";
                    jscode += "{\n";
                    jscode += "document.getElementById(\"txt5\").src=\"/vehiclemanagementsys/upfile/" + map.get("filename5") + "\";\n";
                    jscode += "}\n";

                }
            }

            jscode += "}\n";

            jscode += " getPvalue();\n";
            jscode += "</script>\n";
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jscode;
    }

    /**
     * General file name string.
     *
     * @param srcFileName the src file name
     * @return the string
     */
    public static String generalFileName(String srcFileName) {
        try {
            int index = srcFileName.lastIndexOf(".");
            return StrUtil.generalSrid() + srcFileName.substring(index).toLowerCase();
        } catch (Exception e) {
            return StrUtil.generalSrid();
        }
    }

    /**
     * Gets id.
     *
     * @return the id
     */
    public synchronized static String getID() {
        Random random = new Random();
        StringBuffer ret = new StringBuffer(20);
        String rand = String.valueOf(Math.abs(random.nextInt()));
        ret.append(getDateStr());
        ret.append(rand.substring(0, 6));

        return ret.toString();
    }

			else
				return false;
			*/
    }

}

		

package com.util;

/**
 * The type Smart upload.
 */
public class SmartUpload
{
    /**
     * The M bin array.
     */
    protected byte m_binArray[];
    /**
     * The M request.
     */
    protected HttpServletRequest m_request;
    /**
     * The M response.
     */
    protected HttpServletResponse m_response;
    /**
     * The M application.
     */
    protected ServletContext m_application;
	Saveobject saveobject;
    /**
     * The Ordermsg dao.
     */
    @Resource
	OrdermsgDAO ordermsgDAO;

    /**
     * Cart list string.
     *
     * @param request the request
     * @return the string
     */
// 查询购车相机
	@RequestMapping("cartList")
	public String cartList(HttpServletRequest request) {
		Member member = (Member) request.getSession().getAttribute(
				"sessionmember");
		    //double zk = saveobject.getzk(member.getId());
			HashMap map = new HashMap();
			map.put("memberid", member.getId());
			List<Cart> cartlist = cartDAO.selectAll(map);
			String totalstr = "";
			double total = 0.0;
			for(Cart cart:cartlist){
				Member m = memberDAO.findById(cart.getMemberid());
				Product product = productDAO.findById(cart.getProductid());
				cart.setMember(m);
				cart.setProduct(product);
				double sjprice = 0D;
				double doublesubtotal = 0D;
				if(product.getTprice()>0){
					sjprice = product.getTprice();
					total += Double.parseDouble(String.valueOf(cart.getNum()))* sjprice;
					doublesubtotal = Double.parseDouble(String.valueOf(cart.getNum()))*sjprice;
				}else{
					sjprice = product.getPrice();
					total += Double.parseDouble(String.valueOf(cart.getNum()))* sjprice;
					doublesubtotal = Double.parseDouble(String.valueOf(cart.getNum()))*sjprice;
				}
				cart.setSubtotal(String.format("%.2f", doublesubtotal));
			}
			totalstr = String.format("%.2f", total);
			request.setAttribute("totaldoubel", Double.parseDouble(totalstr));
			request.setAttribute("cartlist", cartlist);
			request.setAttribute("totalstr", totalstr);
		    saveobject.getCategoryObject(request);
		    String suc = request.getParameter("suc")==null?"":request.getParameter("suc");
		    if(!suc.equals("")){
		    	request.setAttribute("suc", "创建成功");
        while (done) {
            start = sourceLowcase.indexOf(from, start);
            if (start == -1) {
                break;
            }
            subLowcase1 = sourceLowcase.substring(0, start);
            sub1 = source.substring(0, start);
            end = sourceLowcase.indexOf(to, start);
            if (end == -1) {
                end = sourceLowcase.indexOf("/>", start);
                if (end == -1) {
                    done = false;
                }
            } else {
                end = end + to.length();
                subLowcase2 = sourceLowcase.substring(end, source.length());
                sub2 = source.substring(end, source.length());
                sourceLowcase = subLowcase1 + subLowcase2;
                source = sub1 + sub2;
            }
            //System.out.println(start+" "+end);
        }
        return source;
    }

    /**
     * Del pic.
     *
     * @param path the path
     * @param img  the img
     */

    /**
     * Gets date poor.
     *
     * @param stime the stime
     * @param etime the etime
     * @return the date poor
            m_response.setHeader("Content-Disposition",m_contentDisposition + " filename=" + getFileName(s));
        }
        else
        {
            if(s2.length() == 0)
            {
                m_response.setHeader("Content-Disposition",m_contentDisposition);
            }
            else
            {
                m_response.setHeader("Content-Disposition",m_contentDisposition + " filename=" + s2);
            }
        }
        while((long)k < l)
        {
            int j = fileinputstream.read(abyte0,0,i);
            k += j;
            m_response.getOutputStream().write(abyte0,0,j);
        }
        fileinputstream.close();
    }

    /**
     * Download field.
     *
     * @param resultset the resultset
     * @param s         the s
     * @param s1        the s 1
     * @param s2        the s 2
     * @throws ServletException the servlet exception
     * @throws IOException      the io exception
     * @throws SQLException     the sql exception
     */
    public void downloadField(ResultSet resultset,String s,String s1,String s2) throws ServletException,IOException,SQLException
    {
        if(resultset == null)
        {
            throw new IllegalArgumentException("The RecordSet cannot be null (1045).");
        }
        if(s == null)
        {
            throw new IllegalArgumentException("The columnName cannot be null (1050).");
        }
        if(s.length() == 0)
        {
            throw new IllegalArgumentException("The columnName cannot be empty (1055).");
			bbsDAO.update(bbs);
			return "redirect:mybbsList.do";
		}

    /**
     * Bbs del string.
     *
     * @param id       the id
     * @param request  the request
     * @param response the response
     * @return the string
     */
//删除帖子
	@RequestMapping("bbsDel")
	public String bbsDel(int id, HttpServletRequest request,HttpServletResponse response){
		Bbs bbs = bbsDAO.findById(id);
		HashMap map = new HashMap();
		map.put("fid",id);
		List<Bbs> list = bbsDAO.selectAll(map);
		for(Bbs b:list){
			bbsDAO.delete(b.getId());
		}
		bbsDAO.delete(id);
		return "redirect:mybbsList.do";
	}

    /**
     * Bbs show string.
     *
     * @param pageNum the page num
     * @param id      the id
     * @param request the request
     * @return the string
     */
//帖子详情
	@RequestMapping("bbsShow")
	public String bbsShow(@RequestParam(defaultValue = "1",value = "pageNum") Integer pageNum,int id,HttpServletRequest request){
		Bbs bbs = bbsDAO.findById(id);
		Member author = memberDAO.findById(bbs.getMid());
                {
                    s1 = s1 + s2;
                }
                else
                {
                    s1 = s1 + s3 + s2;
                }
                return s1;
            }
            if(flag)
            {
                if(m_denyPhysicalPath)
                {
                    throw new IllegalArgumentException("Physical path is denied (1125).");
                }
                else
                {
                    return s;
                }
            }
            else
            {
                throw new IllegalArgumentException("This path does not exist (1135).");
            }
        }
        if(i == 1)
        {
            if(isVirtual(s1))
            {
                s1 = m_application.getRealPath(s1);
                if(s1.endsWith(s3))
                {
                    s1 = s1 + s2;
                }
                else
                {
                    s1 = s1 + s3 + s2;
                }
                return s1;
            }
            if(flag)
            {
                throw new IllegalArgumentException("The path is not a virtual path.");
            }
            else
            {
                throw new IllegalArgumentException("This path does not exist (1135).");
            }
        }

/**
 * The type Bbs controller.
 */
@Controller
public class BbsController extends BaseController {
    /**
     * The News dao.
     */
    @Resource
	NewsDAO newsDAO;
    /**
     * The Category dao.
     */
    @Resource
	CategoryDAO categoryDAO;
    /**
     * The Member dao.
     */
    @Resource
	MemberDAO memberDAO;
    /**
     * The Product dao.
     */
    @Resource
	ProductDAO productDAO;
    /**
     * The Saveobject.
     */
    @Resource
	Saveobject saveobject;
    /**
     * The Ordermsg dao.
     */
    @Resource
	OrdermsgDAO ordermsgDAO;
    /**
     * The Bbs dao.
     */
    @Resource
	BbsDAO bbsDAO;

    /**
     * Bbs list string.
     *
     * @param pageNum the page num
     * @param request the request
 

/**
 * The type Address controller.
 */
@Controller
public class AddressController extends BaseController {
    /**
     * The Address dao.
     */
    @Resource
	AddressDAO addressDAO;
    /**
     * The Category dao.
     */
    @Resource
		String shopid = request.getParameter("shopid");
		String ph = request.getParameter("ph");
		User shop = userDAO.findById(Integer.parseInt(shopid));
		//显示相机列表
   	    HashMap map = new HashMap();
   	    map.put("fid", fid);
   	    map.put("sid", sid);
	    map.put("issj", "yes");
	    map.put("ph", ph);
	    map.put("saver", shopid);
	    map.put("leibie", "购买相机");
	    List<Product> nlist = productDAO.selectAll(map);
	    PageHelper.startPage(pageNum,8);
		List<Product> list = productDAO.selectAll(map);
		PageInfo<Product> pageInfo =  new PageInfo<Product>(list);
		request.setAttribute("pageInfo", pageInfo);
		request.setAttribute("nlist", nlist);
		request.setAttribute("sid", sid);
		request.setAttribute("fid", fid);
		request.setAttribute("shopid", shopid);
		request.setAttribute("shop", shop);
		
		
		String categroystr = "";
		if(sid!=null && !sid.equals("")){
			Category scategory = categoryDAO.findById(Integer.parseInt(sid));
			categroystr=scategory.getName();
			request.setAttribute("categroystr", categroystr);
		}
		if(fid!=null && !fid.equals("")){
			Category fcategory = categoryDAO.findById(Integer.parseInt(fid));
			categroystr=fcategory.getName();
			request.setAttribute("categroystr", categroystr);
		}
		saveobject.getCart(request);
		saveobject.getCategoryObject(request);
		return "shop";
	}

    /**
     * Love recommend string.
     *
     * @param pageNum the page num
     * @param request the request
     * @return the string
     */
//猜你喜欢
		@RequestMapping("loveRecommend")
    {
        m_request = httpservletrequest;
        m_response = httpservletresponse;
    }

    /**
     * Initialize.
     *
     * @param servletconfig       the servletconfig
     * @param httpservletrequest  the httpservletrequest
     * @param httpservletresponse the httpservletresponse
     * @throws ServletException the servlet exception
     */
    public final void initialize(ServletConfig servletconfig,HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse) throws ServletException
    {
        m_application = servletconfig.getServletContext();
        m_request = httpservletrequest;
        m_response = httpservletresponse;
    }

    /**
     * Initialize.
     *
     * @param pagecontext the pagecontext
     * @throws ServletException the servlet exception
     */
    public final void initialize(PageContext pagecontext) throws ServletException
    {
        m_application = pagecontext.getServletContext();
        m_request = (HttpServletRequest)pagecontext.getRequest();
        m_response = (HttpServletResponse)pagecontext.getResponse();
    }

    /**
     * Initialize.
     *
     * @param servletcontext      the servletcontext
     * @param httpsession         the httpsession
     * @param httpservletrequest  the httpservletrequest
     * @param httpservletresponse the httpservletresponse
     * @param jspwriter           the jspwriter
     * @throws ServletException the servlet exception
     * @deprecated Method initialize is deprecated
     */
    public final void initialize(ServletContext servletcontext,HttpSession httpsession,HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse,JspWriter jspwriter) throws ServletException
    {
        m_application = servletcontext;

    /**
     * News msg string.
     *
     * @param pageNum the page num
     * @param request the request
     * @return the string
     */
//前台台查询资讯列表
	@RequestMapping("newsLb")
	public String newsMsg(@RequestParam(defaultValue = "1",value = "pageNum") Integer pageNum,HttpServletRequest request) {
		HashMap map = new HashMap();
		PageHelper.startPage(pageNum, 10);
		List<News> list = newsDAO.selectAll(map);
		for(News news:list){
			String ms = "";
			String str = Info.delHTMLTag(news.getContent().toString());
			if(str.length()>300){
				ms = str.substring(0,160)+"...";
			}else{
				ms = str;
			}
			news.setMs(ms);
		}
		PageInfo<News> pageInfo =  new PageInfo<News>(list);
		
		request.setAttribute("pageInfo", pageInfo);
		saveobject.getCart(request);
		saveobject.getCategoryObject(request);
		
		saveobject.hotSales("",request);
		List<Product> zphlist = saveobject.hotSales("",request);
		request.setAttribute("zphlist", zphlist);
		return "newslb";
	}
	
	
	

}
package com.controller;

请添加图片描述

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值