基于javaweb+mysql的在线商城购物商城服装商城(前台、后台)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
在线商城,实现了商城的基本功能
如分类展示商品信息、搜索商品信息、用户注册登录、添加商品到购物车、提交订单、个人中心查看订单、留言板留言等
管理员登录后台后可以查看管理用户信息、商品分类信息、商品信息、新闻信息、留言信息、订单信息等。
商城模板通用,可修改为任意商城,如手机商城、鲜花商城等等
后台管理员
前台用户
技术框架
CSS JavaScript JSP Servlet JDBC MySQL
rs.getInt("EP_STOCK"),
rs.getInt("EPC_ID"),
rs.getInt("EPC_CHILD_ID"),
rs.getString("EP_FILE_NAME"));
list.add(p);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
Basedao.closeall(rs, ps, conn);
}
return list;
}
/**
* ����ģ����ѯ
* @return
public class EASYBUY_NEWSDao {
public static ArrayList<EASYBUY_NEWS> selectAll(){
ArrayList<EASYBUY_NEWS> list=new ArrayList<EASYBUY_NEWS>();
Connection conn= Basedao.getconn();
PreparedStatement ps=null;
ResultSet rs=null;
try {
ps=conn.prepareStatement("select * from EASYBUY_NEWS");
rs=ps.executeQuery();
while (rs.next()) {
EASYBUY_NEWS c=new EASYBUY_NEWS(rs.getInt("EN_ID"),rs.getString("EN_TITLE") , rs.getString("EN_CONTENT"),rs.getString("EN_CREATE_TIME") );
list.add(c);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
Basedao.closeall(rs, ps, conn);
}else{
document.getElementById("sn").innerHTML="";
document.getElementById("sb").disabled=false;
}
}
function checkpwd(){
var passWord=document.getElementById("passWord").value;
if(passWord==""){
document.getElementById("spwd").innerHTML="<font color='red'>密码不能为空</font>";
document.getElementById("sb").disabled=true;
}else{
document.getElementById("spwd").innerHTML="";
document.getElementById("sb").disabled=false;
}
}
function checkbirthday(){
var birthday=document.getElementById("birthday").value;
if(birthday==""){
document.getElementById("sbb").innerHTML="<font color='red'>生日不能为空</font>";
document.getElementById("sb").disabled=true;
int id = 0;
Connection conn = Basedao.getconn();
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("select EO_ID from easybuy_order order by EO_ID desc limit 0,1");
rs = ps.executeQuery();
if(rs.next()){
id = rs.getInt(1);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
Basedao.closeall(rs, ps, conn);
}
return id;
}
if(op[i].checked)
{
sum+=parseInt(parseInt(price[i].innerText)*parseInt(number[i].value));
}
}
document.getElementById("zdzj").innerHTML=sum;
document.getElementById("jstext").value=sum;
var money=document.getElementById("zdzj").innerText;
if(money=="0"){
document.getElementById("jsbutton").style.display='none';
document.getElementById("xzText").hidden=false;
}else{
document.getElementById("xzText").hidden=true;
document.getElementById("jsbutton").style.display='inline';
}
}
p.getEP_DESCRIPTION(),
p.getEP_PRICE(),
p.getEP_STOCK(),
p.getEPC_ID(),
p.getEPC_CHILD_ID(),
p.getEP_ID()};
return Basedao.exectuIUD(sql, params);
}
}
public static int del(int id){
String sql = "delete from EASYBUY_PRODUCT where EP_ID=?";
Object[] params = {id};
return Basedao.exectuIUD(sql, params);
}
public static int totalPage(int count){
int tpage = 1;
sp.getEs_EU_USER_ID()};
return Basedao.exectuIUD(sql, params);
}
public static int getDeleteDD(int id){
String sql="delete from easybuy_shop where es_id=?";
Object [] params={id};
return Basedao.exectuIUD(sql, params);
}
}
package com.demo.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
if(sum%count==0){
tpage=sum/count;
}else{
tpage=sum/count+1;
}
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
Basedao.closeall(rs, ps, conn);
}
return tpage;
}
/**
* ��ҳ��ѯ
*/
public static ArrayList<EASYBUY_ORDER> selectAll(int cpage,int count,String id,String name){
ArrayList<EASYBUY_ORDER> list=new ArrayList<EASYBUY_ORDER>();
Connection conn=Basedao.getconn();
return tpage;
}
/**
* ��ҳ��ѯ
*/
public static ArrayList<EASYBUY_ORDER> selectAll(int cpage,int count,String id,String name){
ArrayList<EASYBUY_ORDER> list=new ArrayList<EASYBUY_ORDER>();
Connection conn=Basedao.getconn();
PreparedStatement ps=null;
ResultSet rs=null;
try {
ArrayList params = new ArrayList();
String query_sql = "select * from EASYBUY_ORDER where 1=1 ";
if(id!=null && !"".equals(id)){
query_sql += " and EO_ID=?";
params.add(id);
}
if(name!=null && !"".equals(name)){
query_sql += " and EO_USER_NAME like ? ";
params.add("%"+name+"%");
}
query_sql+=" order by EO_ID desc limit ?,?";
String sql ="select * from("+
"select rownum rn,a.* from("+
query_sql+
")a)b where b.rn between ? and ?";
/**
* ��ҳ����
* @param u
* @return
*/
public static int totalPage(int count){
int tpage=1;
Connection conn=Basedao.getconn();
PreparedStatement ps=null;
ResultSet rs=null;
try {
ps=conn.prepareStatement("select count(*) from EASYBUY_USER");
rs=ps.executeQuery();
while(rs.next()){
int sum=rs.getInt(1);
if(sum%count==0){
tpage=sum/count;
}else{
tpage=sum/count+1;
}
}
} catch (SQLException e) {
e.printStackTrace();
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理 - 在线购物商城</title>
<link type="text/css" rel="stylesheet" href="../css/style.css" />
<script type="text/javascript" src="..//scripts/function-manage.js"></script>
<script type="text/javascript" src="..//scripts/calendar.js"></script>
<script type="text/javascript">
function checkusername(){
var username=document.getElementById("userName").value;
if(username==""){
document.getElementById("sp").innerHTML="<font color='red'>用户名不能为空</font>";
document.getElementById("sb").disabled=true;
}else{
document.getElementById("sp").innerHTML="";
document.getElementById("sb").disabled=false;
}
}
function checkname(){
var name1=document.getElementById("name").value;
if(name1==""){
document.getElementById("sn").innerHTML="<font color='red'>姓名不能为空</font>";
document.getElementById("sb").disabled=true;
}else{
document.getElementById("sn").innerHTML="";
document.getElementById("sb").disabled=false;
}
</div>
</div>
<%@ include file="/include/search_bar.jsp" %>
<div id="position" class="wrap">
您现在的位置:<a href="indexSelect">在线购物商城</a> > <a href="selectProductList">商品分类</a> > ${title }
</div>
<div id="main" class="wrap">
<div class="lefter">
<div class="box">
<h2>商品分类</h2>
<dl>
<dt><a href="selectProductList">全部商品</a></dt>
<c:forEach var="f" items="${flist}">
<dt><a href="selectProductList?fid=${f.EPC_ID }">${f.EPC_NAME }</a></dt>
<c:forEach var="c" items="${clist}">
<c:if test="${f.EPC_ID==c.EPC_PARENT_ID}">
<c:if test="${p.EPC_CHILD_ID!=c.EPC_ID}">
<dd><a href="selectProductList?cid=${c.EPC_ID }">${c.EPC_NAME }</a></dd>
</c:if>
</c:if>
</c:forEach>
</c:forEach>
</dl>
Basedao.closeall(rs, ps, conn);
}
return u;
}
/**
* �鿴�Ƿ��д���
* @param id
* @return
*/
public static int selectByName(String id){
int count=0;
ResultSet rs = null;
Connection conn = Basedao.getconn();
PreparedStatement ps = null;
try {
ps = conn.prepareStatement("select count(*) from EASYBUY_USER where EU_USER_ID=?");
ps.setString(1, id);
rs = ps.executeQuery();
while(rs.next()){
count=rs.getInt(1);
}
} catch (SQLException e) {
e.printStackTrace();
}finally {
Basedao.closeall(rs, ps, conn);
}
int min = (page-1)*pages;
int max = pages;
try {
conn = Basedao.getconn();
String sql = "select * from easybuy_comment where ec_nick_name=? order by ec_create_time desc limit "+min+","+max;
pst = conn.prepareStatement(sql);
pst.setString(1, name);
rs = pst.executeQuery();
while(rs.next()){
EASYBUY_COMMENT com = new EASYBUY_COMMENT();
com.setEC_ID(rs.getInt("ec_id"));
com.setEC_CONTENT(rs.getString("ec_content"));
com.setEC_CREATE_TIME(rs.getString("ec_create_time"));
com.setEC_NICK_NAME(rs.getString("ec_nick_name"));
com.setEC_REPLY(rs.getString("ec_reply"));
com.setEC_REPLY_TIME(rs.getString("ec_reply_time"));
al.add(com);
}
} catch (Exception e) {
e.printStackTrace();
}finally{
Basedao.closeall(rs, pst, conn);
}
return al;
}
}