基于javaweb+JSP+Servlet在线商城购物商城服装商城(前台、后台)
开发工具:eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import com.demo.entity.EASYBUY_PRODUCT_CATEGORY;
import com.demo.util.Basedao;
public class EASYBUY_PRODUCT_CATEGORYDao {
/**
* ��ѯ����
* @return
*/
public static ArrayList<EASYBUY_PRODUCT_CATEGORY> selectAll(){
ArrayList<EASYBUY_PRODUCT_CATEGORY> list = new ArrayList<EASYBUY_PRODUCT_CATEGORY>();
ResultSet rs = null;
* @param count
* @return
*/
public static ArrayList<EASYBUY_PRODUCT> selectAll(int cpage,int count){
ArrayList<EASYBUY_PRODUCT> list = new ArrayList<EASYBUY_PRODUCT>();
Connection conn =Basedao.getconn();
PreparedStatement ps = null;
ResultSet rs = null;
String sql = "select * from EASYBUY_PRODUCT order by EP_ID desc limit ?,? ";
try {
ps = conn.prepareStatement(sql);
//������������
ps.setInt(1, count*(cpage-1));
ps.setInt(2, count);
rs = ps.executeQuery();
while(rs.next()) {
EASYBUY_PRODUCT p = new EASYBUY_PRODUCT(rs.getInt("EP_ID"),
rs.getString("EP_NAME"),
rs.getString("EP_DESCRIPTION"),
rs.getInt("EP_PRICE"),
rs.getInt("EP_STOCK"),
rs.getInt("EPC_ID"),
rs.getInt("EPC_CHILD_ID"),
rs.getString("EP_FILE_NAME"));
list.add(p);
}
} catch (SQLException e) {
Connection conn =Basedao.getconn();
PreparedStatement ps = null;
ResultSet rs = null;
String sql = "select * from EASYBUY_PRODUCT where EPC_ID = ? order by EP_ID desc limit ?,?";
try {
ps = conn.prepareStatement(sql);
//������������
ps.setInt(1, fid);
ps.setInt(2, count*(cpage-1));
ps.setInt(3, count);
rs = ps.executeQuery();
while(rs.next()) {
EASYBUY_PRODUCT p = new EASYBUY_PRODUCT(rs.getInt("EP_ID"),
rs.getString("EP_NAME"),
rs.getString("EP_DESCRIPTION"),
rs.getInt("EP_PRICE"),
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();
css(this.getElementsByTagName('div')[0],{
'top' : Math.min(Math.max(pos.y - this.offsetTop - parseInt(this.getElementsByTagName('div')[0].style.height) / 2,0),this.clientHeight - this.getElementsByTagName('div')[0].offsetHeight) + 'px',
'left' : Math.min(Math.max(pos.x - this.offsetLeft - parseInt(this.getElementsByTagName('div')[0].style.width) / 2,0),this.clientWidth - this.getElementsByTagName('div')[0].offsetWidth) + 'px' //left=鼠标x - this.offsetLeft - 浏览框宽/2,Math.max和Math.min让浏览框不会超出图像
})
magnifier.m.mag.style.display = '';
css(magnifier.m.img,{
'top' : - (parseInt(this.getElementsByTagName('div')[0].style.top) * magnifier.m.scale) + 'px',
'left' : - (parseInt(this.getElementsByTagName('div')[0].style.left) * magnifier.m.scale) + 'px'
})
},
end:function(e){
this.getElementsByTagName('div')[0].style.display = 'none';
magnifier.removeIframe(magnifier.m.img); //销毁iframe
magnifier.m.mag.style.display = 'none';
},
createIframe:function(elem){
var layer = document.createElement('iframe');
layer.tabIndex = '-1';
layer.src = 'javascript:false;';
elem.parentNode.appendChild(layer);
u.getEU_ADDRESS(),
u.getEU_STATUS()};
return Basedao.exectuIUD(sql, params);
}
public static int update(EASYBUY_USER u){
String sql = "update EASYBUY_USER set EU_USER_NAME=?," +
"EU_PASSWORD=?," +
"EU_SEX=?," +
"EU_BIRTHDAY=DATE_FORMAT(?,'%Y-%m-%d')," +
"EU_IDENTITY_CODE=?," +
"EU_EMAIL=?," +
"EU_MOBILE=?," +
"EU_ADDRESS=?," +
"EU_STATUS=? " +
"where EU_USER_ID=?";
Object[] params = {u.getEU_USER_NAME(),
u.getEU_PASSWORD(),
e.printStackTrace();
}finally {
Basedao.closeall(rs, ps, conn);
}
return user;
}
/**
* ��ҳ����
* @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{
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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.js">script>
<script type="text/javascript">
function jump(p){
location.href='selectProductList?cp='+p;
}
script>
<script type="text/javascript">
function selectname(){
var name = document.getElementById("selectname").value;
location.href='selectProductList?name='+name;
}
function searchHot(name){
location.href='selectProductList?name='+name;
}
script>
head>
<body>
<div id="header" class="wrap">
}
}catch(Exception e){
e.printStackTrace();
}finally{
Basedao.closeall(rs, pst, conn);
}
return max;
}
//ǰ̨��ҳ
public static ArrayList<EASYBUY_COMMENT> selPages(String name,int page,int pages){
ArrayList<EASYBUY_COMMENT> al=new ArrayList<EASYBUY_COMMENT>();
Connection conn=null;
PreparedStatement pst= null;
ResultSet rs= null;
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();
*/
public static ArrayList<EASYBUY_USER> selectAll(){
ArrayList<EASYBUY_USER> list = new ArrayList<EASYBUY_USER>();
ResultSet rs = null;
Connection conn = Basedao.getconn();
PreparedStatement ps = null;
try {
ps = conn.prepareStatement("select * from EASYBUY_USER");
rs = ps.executeQuery();
while(rs.next()){
EASYBUY_USER u = new EASYBUY_USER(rs.getString("EU_USER_ID"),
rs.getString("EU_USER_NAME"),
rs.getString("EU_PASSWORD"),
rs.getString("EU_SEX"),
rs.getString("EU_BIRTHDAY"),
rs.getString("EU_IDENTITY_CODE"),
rs.getString("EU_EMAIL"),
rs.getString("EU_MOBILE"),
rs.getString("EU_ADDRESS"),
rs.getInt("EU_STATUS"));
list.add(u);
运行环境
Java≥8、Tomcat≥7.0、MySQL≥5.5
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
技术框架
CSS JavaScript JSP Servlet JDBC MySQL
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
在线商城,实现了商城的基本功能
如分类展示商品信息、搜索商品信息、用户注册登录、添加商品到购物车、提交订单、个人中心查看订单、留言板留言等
管理员登录后台后可以查看管理用户信息、商品分类信息、商品信息、新闻信息、留言信息、订单信息等。
商城模板通用,可修改为任意商城,如手机商城、鲜花商城等等
后台管理员
前台用户
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)