失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > SSM框架中医电子商务网站中医购物网站中医书籍中医药品药材(idea开发javaweb-javaee-j

SSM框架中医电子商务网站中医购物网站中医书籍中医药品药材(idea开发javaweb-javaee-j

时间:2019-06-22 19:09:31

相关推荐

SSM框架中医电子商务网站中医购物网站中医书籍中医药品药材(idea开发javaweb-javaee-j

0、效果展示

1、概述

2、搭建环境

本文以实现一个中医电子商务网站为目标,从环境搭建到编码实现全过程讲述

我们使用javaweb、J2EE来构建中医电子商务网站,环境使用最新版jdk和tomcat,配合mysql数据库

开发工具使用idea(也可以使用eclipse),数据库管理工具使用Navicat Premium

开发框架使用JavaBeanServlet MVC结构;

没有使用SSH(Struts+Spring+Hibernate)或SSM(Spring+SpringMVC+MyBatis),这两个框架我们在别的项目中再介绍开发过程

在项目中会引入My97DatePicker作为前端日期时间选择工具,使用fckeditor作为富媒体编辑器(也可以使用百度的ueditor)

使用DWR(Direct Web Remoting)用于改善web页面与Java类交互,实现远程服务器端AJAX读取登录数据。

使用JSTL(Java server pages standarded tag library,即JSP标准标签库),此库是由JCP(Java community Proces)所制定的标准规范,它主要提供给Java Web开发人员一个标准通用的标签库,并由Apache的Jakarta小组来维护。开发人员可以利用这些标签取代JSP页面上的Java代码,从而提高程序的可读性,降低程序的维护难度。

3、数据表结构

表3 CustomerInfo 客户信息

表4 GoodsInfo 商品表

​4、后端代码示例

package com.control.admin;import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import com.dao.ThirdInfoDAO;import com.util.PublicToolCheckParam;import com.util.PublicToolShowThirdInfoList;public class ManageThirdInfo extends HttpServlet {/*** */private static final long serialVersionUID = 3099608914702213565L;static ThirdInfoDAO cdao = new ThirdInfoDAO();public static void coolThirdInfo(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {String thirdId = request.getParameter("thirdId");String isCooled = request.getParameter("isCooled");if(PublicToolCheckParam.checkNullAndEmpty(thirdId) && PublicToolCheckParam.checkNullAndEmpty(isCooled)){cdao.coolThird(Integer.parseInt(thirdId),Integer.parseInt(isCooled));String isSearching = request.getParameter("isSearching");String currentPage = request.getParameter("currentPage");if(PublicToolCheckParam.checkNullAndEmpty(isSearching)){String key = request.getParameter("key");PublicToolShowThirdInfoList.searchThirdInfo(request, response, currentPage, key);request.setAttribute("key", key);request.setAttribute("isSearching", "yes");}else{PublicToolShowThirdInfoList.showThirdInfoList(request, response, currentPage);}}request.getRequestDispatcher("../admin/manageThirdInfo.jsp").forward(request, response);}public static void coolMoreThirdInfo(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {String currentPage = request.getParameter("currentPage");String[] ckb = request.getParameterValues("ckb");if(ckb != null){for(int i=0;i<ckb.length;i++){//cdao.coolThird(Integer.parseInt(ckb[i]));}}PublicToolShowThirdInfoList.showThirdInfoList(request, response, currentPage);request.getRequestDispatcher("../admin/manageThirdInfo.jsp").forward(request, response);}public static void searchThirdInfo(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {String currentPage = request.getParameter("currentPage");String key = request.getParameter("key");PublicToolShowThirdInfoList.searchThirdInfo(request, response, currentPage, key);request.setAttribute("isSearching", "yes");request.setAttribute("key", key);request.getRequestDispatcher("../admin/manageThirdInfo.jsp").forward(request, response);}public static void showManageThirdInfoPage(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {String currentPage = request.getParameter("currentPage");PublicToolShowThirdInfoList.showThirdInfoList(request, response, currentPage);request.getRequestDispatcher("../admin/manageThirdInfo.jsp").forward(request, response);}/*** Constructor of the object.*/public ManageThirdInfo() {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 {doPost(request, response);}/*** 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 {String method = request.getParameter("method");if(PublicToolCheckParam.checkNullAndEmpty(method)){if(method.equals("showManageThirdInfoPage")){showManageThirdInfoPage(request, response);}else if(method.equals("cool")){coolThirdInfo(request, response);}else if(method.equals("coolMore")){coolMoreThirdInfo(request, response);}else if(method.equals("search")){searchThirdInfo(request, response);}}}/*** Initialization of the servlet. <br>** @throws ServletException if an error occurs*/public void init() throws ServletException {// Put your code here}}

5、前端代码示例

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%@page import="com.util.PublicToolCheckParam"%><%@page import="com.entity.OrderInfo"%><%@page import="com.dao.ThirdInfoDAO"%><%@page import="com.entity.ThirdInfo"%><%@page import="com.util.Validate"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>商户信息管理</title><link type="text/css" rel="stylesheet" href="../css/style.css" /><script type="text/javascript" src="../js/admin/manageThirdInfo.js" charset="gb2312"></script></head><body><form action="../servlet/ManageThirdInfo?method=coolMore&isCooled" method="post"><table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-size:13px;"><tr><td width="100%" height="36"><strong><font size="6" color="#0099FF">□&nbsp;</font><font color="#666666" size="3">商户信息管理</font></strong></td><td height="36"><div align="right"><input type="text" name="key" id="key" style="height: 24px;width: 250px;padding-top: 2px;padding-left:20px;background-image: url(../image/icon/key_search.gif);background-repeat: no-repeat"/></div></td><td><input type="button" value="查询" style="height: 26px;width: 70px;padding-top: 2px" onClick="return searchThirdInfo()"/></td><!--<td><input type="submit" value="商户取消审核" style="height: 26px;width: 70px;padding-top: 2px" onClick="return coolMoreThirdInfo()"/></td>--></tr><tr><td height="40" colspan="4"><hr width="100%"/></td></tr><tr><td height="147" colspan="4"><table width="100%" border="1" cellpadding="0" cellspacing="0" style="font-size:13px" bordercolor="#9999FF"> <tr height="30"><!--<td width="50"><div align="center"><font color="#666666">全选</font></div></td><td width="40"><div align="center"><input type="checkbox" id="checkAll" value="checkbox" onClick="selectAll()"/></div></td>--><td><div align="center"><font color="#666666">商户编号</font></div></td><td><div align="center"><font color="#666666">审核状态</font></div></td><td><div align="center"><font color="#666666">商户账户/邮箱</font></div></td><td><div align="center"><font color="#666666">注册时间</font></div></td><td><div align="center"><font color="#666666">商户名称</font></div></td><td><div align="center"><font color="#666666">联系电话</font></div></td><td><div align="center"><font color="#666666">联系地址</font></div></td><td width="70"><div align="center"><font color="#666666">操作</font></div></td></tr><%String isSearching = (String)request.getAttribute("isSearching");String name = "无";String telephone = "无";String movePhone = "无";String address = "无";ArrayList<ThirdInfo> ThirdInfoList = (ArrayList<ThirdInfo>)request.getAttribute("ThirdInfoList");//ThirdDetailInfoDAO cddao = new ThirdDetailInfoDAO();if(ThirdInfoList == null || ThirdInfoList.toString().equals("[]")){out.println("<td colspan='11' height='30'><div align='center'>当前无任何商户信息!</div></td>");}else{for(int i=0;i<ThirdInfoList.size();i++){ThirdInfo ct = ThirdInfoList.get(i);//boolean isExist = cddao.isThirdDetailInfo(ct.getId());//if(isExist == true){//ThirdDetailInfo ThirdDetailInfo = cddao.getThirdDetailInfo(ct.getId());//}out.println("<tr height='30'>");//out.println("<td><div align='center'>勾选</div></td>");//out.println("<td><div align='center'><input id='ckb' type='checkbox' name='ckb' value='"+ct.getId()+"' /></div></td>");out.println("<td><div align='center'>"+ct.getId()+"</div></td>");if(ct.getIsCooled() == 1){out.println("<td><div align='center'><font color='#FF0000'>未审核</font></div></td>");}else{out.println("<td><div align='center'>已审核</div></td>");}Validate v = new Validate();out.println("<td><div align='center'>"+ct.getEmail()+"</div></td>");out.println("<td><div align='center'>"+v.datemmddtime(ct.getRegisterTime())+"</div></td>");out.println("<td><div align='center'>"+ct.getthirdName()+"</div></td>");out.println("<td><div align='center'>"+ct.getPhone()+"</div></td>");out.println("<td><div align='center'>"+ct.getAddress()+"</div></td>");if(PublicToolCheckParam.checkNullAndEmpty(isSearching) && ThirdInfoList.size() > 1){if(ct.getIsCooled() == 1){out.println("<td><div align='center'><a href='#' onclick=coolThirdInfoOfSearching("+ct.getId()+","+ct.getIsCooled()+","+request.getAttribute("key")+")>取消审核</a></div></td>");}else{out.println("<td><div align='center'><a href='#' onclick=coolThirdInfoOfSearching("+ct.getId()+","+ct.getIsCooled()+","+request.getAttribute("key")+")>审核通过</a></div></td>");}}else{if(ct.getIsCooled() == 1){out.println("<td><div align='center'><a href='#' onclick=coolThirdInfo("+ct.getId()+","+ct.getIsCooled()+")>审核通过 </a></div></td>");}else{out.println("<td><div align='center'><a href='#' onclick=coolThirdInfo("+ct.getId()+","+ct.getIsCooled()+")>取消审核</a></div></td>");}}out.println("</tr>");}}%><tr><td colspan="11" height="50"><div align="center">共找到<%=request.getAttribute("sumCount")%>条记录</div></td></tr></table></td></tr></table></form></body></html>

SSM框架中医电子商务网站中医购物网站中医书籍中医药品药材(idea开发javaweb-javaee-j2ee-springboot)

如果觉得《SSM框架中医电子商务网站中医购物网站中医书籍中医药品药材(idea开发javaweb-javaee-j》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。