代码注释

xhy_branch
xhy 8 months ago
parent 0202dcc640
commit 48346a59b6

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Class-Path:

@ -0,0 +1,164 @@
package com.itbaizhan.action;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
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.itbaizhan.orm.Tgoods;
import com.itbaizhan.orm.Torder;
import com.itbaizhan.orm.TorderItem;
import com.itbaizhan.orm.Tuser;
import com.itbaizhan.service.liuService;
import com.itbaizhan.util.Cart;
// 继承自HttpServlet类这是一个典型的Servlet类用于处理客户端请求
public class buy_servlet extends HttpServlet {
// service方法处理所有客户端请求
// req: HttpServletRequest请求对象res: HttpServletResponse响应对象
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String type = req.getParameter("type"); // 获取URL传来的type参数决定执行的操作
// 判断type的值调用不同的操作方法
if (type.endsWith("addToCart")) {
addToCart(req, res); // 如果操作是添加到购物车
}
if (type.endsWith("orderSubmit")) {
orderSubmit(req, res); // 如果操作是提交订单
}
if (type.endsWith("myorder")) {
myorder(req, res); // 如果操作是查看我的订单
}
if (type.endsWith("orderDetail")) {
orderDetail(req, res); // 如果操作是查看订单明细
}
}
// 添加商品到购物车
public void addToCart(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String goods_id = req.getParameter("goods_id"); // 获取商品ID
int quantity = Integer.parseInt(req.getParameter("quantity")); // 获取商品数量
// 根据商品ID获取商品详情
Tgoods goods = liuService.getGoods(goods_id);
// 创建订单项对象,设置商品和商品数量
TorderItem orderItem = new TorderItem();
orderItem.setGoods(goods);
orderItem.setGoods_quantity(quantity);
// 获取session中的购物车对象
HttpSession session = req.getSession();
Cart cart = (Cart) session.getAttribute("cart");
// 将商品添加到购物车
cart.addGoods(goods_id, orderItem);
// 更新session中的购物车
session.setAttribute("cart", cart);
// 设置成功信息和跳转路径
req.setAttribute("message", "操作成功");
req.setAttribute("path", "site/cart/mycart.jsp"); // 跳转到购物车页面
// 跳转到成功页面
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res); // 跳转到目标页面
}
// 提交订单
public void orderSubmit(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String songhuodizhi = req.getParameter("songhuodizhi"); // 获取送货地址
String fukuanfangshi = req.getParameter("fukuanfangshi"); // 获取付款方式
// 从session中获取购物车对象和当前用户信息
HttpSession session = req.getSession();
Cart cart = (Cart) session.getAttribute("cart");
Tuser user = (Tuser) session.getAttribute("user");
// 创建订单对象并设置相关属性
Torder order = new Torder();
order.setId(String.valueOf(new Date().getTime())); // 设置订单ID使用当前时间戳
order.setBianhao(new SimpleDateFormat("yyyyMMddhhmmss").format(new Date())); // 设置订单编号
order.setShijian(new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date())); // 设置下单时间
order.setZhuangtai("no"); // 订单状态,默认是“未支付”
order.setHuifu(""); // 订单回复信息
order.setSonghuodizhi(songhuodizhi); // 送货地址
order.setFukuanfangshi(fukuanfangshi); // 付款方式
order.setJine(cart.getTotalPrice()); // 总金额
order.setUser_id(user.getId()); // 用户ID
// 保存订单到数据库
liuService.saveOrder(order);
// 遍历购物车中的商品项,保存订单项信息
for (Iterator it = cart.getItems().values().iterator(); it.hasNext();) {
TorderItem orderItem = (TorderItem) it.next(); // 获取购物车中的每一项商品
String id = String.valueOf(new Date().getTime()); // 创建一个新的订单项ID
String order_id = order.getId(); // 获取订单ID
String goods_id = orderItem.getGoods().getId(); // 获取商品ID
int goods_quantity = orderItem.getGoods_quantity(); // 获取商品数量
// 保存订单项信息
liuService.saveOrderItem(id, order_id, goods_id, goods_quantity);
}
// 清空购物车
cart.getItems().clear();
session.setAttribute("cart", cart);
// 将订单信息传递到页面
req.setAttribute("order", order);
req.getRequestDispatcher("site/order/orderSubmit.jsp").forward(req, res); // 跳转到订单提交页面
}
// 查看我的订单
public void myorder(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
HttpSession session = req.getSession();
Tuser user = (Tuser) session.getAttribute("user");
// 从数据库获取当前用户的所有订单
req.setAttribute("orderList", liuService.orderList(user.getId()));
req.getRequestDispatcher("site/order/myorder.jsp").forward(req, res); // 跳转到我的订单页面
}
// 查看订单明细
public void orderDetail(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String order_id = req.getParameter("order_id"); // 获取订单ID
// 打印订单ID调试用
System.out.println(order_id + "DD");
// 从数据库获取订单项信息
req.setAttribute("orderItemList", liuService.orderItemList(order_id));
req.getRequestDispatcher("site/order/orderDetail.jsp").forward(req, res); // 跳转到订单明细页面
}
// 跳转到目标页面
public void dispatch(String targetURI, HttpServletRequest request, HttpServletResponse response) {
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try {
dispatch.forward(request, response); // 转发请求到目标页面
} catch (ServletException | IOException e) {
e.printStackTrace(); // 异常处理
}
}
// 初始化Servlet配置
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
// 销毁Servlet通常用来释放资源
public void destroy() {
}
}

@ -0,0 +1,126 @@
package com.itbaizhan.action;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.itbaizhan.dao.DB;
import com.itbaizhan.orm.Tcatelog;
// 继承HttpServlet类处理关于菜品类别的增删改查操作
public class catelog_servlet extends HttpServlet {
// service方法是Servlet的核心方法接收请求并分发到不同的功能方法
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String type = req.getParameter("type"); // 获取请求的type参数判断要执行的操作类型
// 根据type值决定执行相应的功能
if (type.endsWith("catelogAdd")) {
catelogAdd(req, res); // 添加菜品类别
}
if (type.endsWith("catelogMana")) {
catelogMana(req, res); // 菜品类别管理
}
if (type.endsWith("catelogDel")) {
catelogDel(req, res); // 删除菜品类别
}
}
// 添加菜品类别
public void catelogAdd(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
// 获取请求参数并设置类别的ID使用当前时间戳
String id = String.valueOf(new Date().getTime());
String name = req.getParameter("name").trim(); // 获取类别名称并去除空格
String del = "no"; // 设置删除标记默认为“no”表示未删除
// 编写SQL插入语句将菜品类别信息插入到数据库中
String sql = "insert into t_catelog(id,name,del) values(?,?,?)";
Object[] params = { id, name, del }; // 参数化SQL查询防止SQL注入
// 创建DB对象并执行SQL语句
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行SQL语句
mydb.closed(); // 关闭数据库连接
// 设置操作成功消息
req.setAttribute("msg", "操作成功");
String targetURL = "/common/msg.jsp"; // 跳转页面路径
dispatch(targetURL, req, res); // 跳转到成功提示页面
}
// 菜品类别管理,展示所有未删除的类别
public void catelogMana(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
List catelogList = new ArrayList(); // 存储所有菜品类别的列表
// 查询所有未删除的菜品类别
String sql = "select * from t_catelog where del='no'";
Object[] params = {}; // 查询没有参数
DB mydb = new DB(); // 创建DB对象用于执行查询操作
try {
mydb.doPstm(sql, params); // 执行SQL查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
// 循环处理查询结果
while (rs.next()) { // 如果有更多数据,继续处理
Tcatelog catelog = new Tcatelog(); // 创建Tcatelog对象用于存储每个类别的信息
catelog.setId(rs.getString("id")); // 设置类别ID
catelog.setName(rs.getString("name")); // 设置类别名称
catelogList.add(catelog); // 将类别对象添加到列表中
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace(); // 处理异常
}
mydb.closed(); // 关闭数据库连接
// 将类别列表传递到前端页面
req.setAttribute("catelogList", catelogList);
req.getRequestDispatcher("admin/catelog/catelogMana.jsp").forward(req, res); // 跳转到类别管理页面
}
// 删除菜品类别将del字段设置为“yes”表示删除
public void catelogDel(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
// 获取请求中传递的类别ID并执行SQL更新语句
String sql = "update t_catelog set del='yes' where id=" + req.getParameter("id");
Object[] params = {}; // 删除操作没有额外的参数
DB mydb = new DB(); // 创建DB对象
mydb.doPstm(sql, params); // 执行更新操作
mydb.closed(); // 关闭数据库连接
// 设置操作成功消息
req.setAttribute("msg", "操作成功");
String targetURL = "/common/msg.jsp"; // 跳转页面路径
dispatch(targetURL, req, res); // 跳转到成功提示页面
}
// 跳转到指定页面
public void dispatch(String targetURI, HttpServletRequest request, HttpServletResponse response) {
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI); // 获取RequestDispatcher对象
try {
dispatch.forward(request, response); // 将请求转发到目标页面
} catch (ServletException | IOException e) {
e.printStackTrace(); // 处理异常
}
}
// 初始化Servlet配置
public void init(ServletConfig config) throws ServletException {
super.init(config); // 调用父类的初始化方法
}
// 销毁Servlet通常用来释放资源
public void destroy() {
// 可以进行资源释放的操作(此处为空)
}
}

@ -0,0 +1,312 @@
package com.itbaizhan.action;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.itbaizhan.dao.DB;
import com.itbaizhan.orm.Tgoods;
import com.itbaizhan.service.liuService;
public class goods_servlet extends HttpServlet {
// 处理所有的请求根据type来区分不同的操作
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String type = req.getParameter("type");
// 判断type并调用相应的方法进行处理
if (type.endsWith("goodsAdd")) {
goodsAdd(req, res); // 添加商品
}
if (type.endsWith("goodsMana")) {
goodsMana(req, res); // 商品管理
}
if (type.endsWith("goodsDel")) {
goodsDel(req, res); // 删除商品
}
if (type.endsWith("goodsDetailHou")) {
goodsDetailHou(req, res); // 后台查看商品详细信息
}
if (type.endsWith("goodsPre")) {
goodsPre(req, res); // 商品信息添加前的准备工作
}
if (type.endsWith("goodsEdit")) {
goodsEdit(req, res); // 编辑商品信息
}
if (type.endsWith("goodsNew")) {
goodsNew(req, res); // 获取最新商品
}
if (type.endsWith("goodsByCatelog")) {
goodsByCatelog(req, res); // 按商品类别查看商品
}
if (type.endsWith("goodsDetailQian")) {
goodsDetailQian(req, res); // 前台查看商品详细信息
}
if (type.endsWith("goodsRes")) {
goodsRes(req, res); // 根据商品名称搜索商品
}
}
// 添加商品
public void goodsAdd(HttpServletRequest req, HttpServletResponse res) {
String id = String.valueOf(new Date().getTime()); // 使用当前时间戳作为商品 ID
String catelog_id = req.getParameter("catelog_id");
String bianhao = req.getParameter("bianhao");
String mingcheng = req.getParameter("mingcheng");
String jieshao = req.getParameter("jieshao");
String fujian = req.getParameter("fujian");
int shichangjia = Integer.parseInt(req.getParameter("shichangjia"));
int tejia = Integer.parseInt(req.getParameter("shichangjia")); // 可能是设置的特价,暂时设置为与市场价一样
String del = "no"; // 标记商品未删除
// SQL语句插入商品数据
String sql = "insert into t_goods(id, catelog_id, bianhao, mingcheng, jieshao, fujian, shichangjia, tejia, del) values(?,?,?,?,?,?,?,?,?)";
Object[] params = {id, catelog_id, bianhao, mingcheng, jieshao, fujian, shichangjia, tejia, del};
// 使用数据库操作类执行插入操作
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行SQL插入
mydb.closed(); // 关闭数据库连接
// 返回操作成功信息并跳转至指定页面
req.setAttribute("msg", "操作成功");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res); // 转发到操作成功页面
}
// 商品管理,查看所有商品
public void goodsMana(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
List goodsList = new ArrayList();
String sql = "select * from t_goods where del='no'"; // 查询所有未删除的商品
Object[] params = {};
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询操作
ResultSet rs = mydb.getRs();
while (rs.next()) {
Tgoods goods = new Tgoods(); // 创建Tgoods对象并填充数据
goods.setId(rs.getString("id"));
goods.setCatelog_id(rs.getString("catelog_id"));
goods.setBianhao(rs.getString("bianhao"));
goods.setMingcheng(rs.getString("mingcheng"));
goods.setJieshao(rs.getString("jieshao"));
goods.setFujian(rs.getString("fujian"));
goods.setShichangjia(rs.getInt("shichangjia"));
goods.setTejia(rs.getInt("tejia"));
goods.setDel(rs.getString("del"));
goodsList.add(goods); // 将商品添加到列表中
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
// 将商品列表传递到前端页面
req.setAttribute("goodsList", goodsList);
req.getRequestDispatcher("admin/goods/goodsMana.jsp").forward(req, res);
}
// 删除商品
public void goodsDel(HttpServletRequest req, HttpServletResponse res) {
String id = req.getParameter("id");
String sql = "update t_goods set del='yes' where id=" + id; // 更新商品的del字段为'yes'表示删除
Object[] params = {};
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行删除操作
mydb.closed();
req.setAttribute("msg", "操作成功");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res); // 转发到操作成功页面
}
// 后台查看商品详细信息
public void goodsDetailHou(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String id = req.getParameter("id");
req.setAttribute("goods", liuService.getGoods(id)); // 从服务层获取商品详细信息
req.getRequestDispatcher("admin/goods/goodsDetailHou.jsp").forward(req, res);
}
// 商品信息添加前的准备工作
public void goodsPre(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
Tgoods goods = new Tgoods();
String sql = "select * from t_goods where id=?";
Object[] params = {req.getParameter("id")};
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询操作
ResultSet rs = mydb.getRs();
while (rs.next()) {
goods.setId(rs.getString("id"));
goods.setCatelog_id(rs.getString("catelog_id"));
goods.setBianhao(rs.getString("bianhao"));
goods.setMingcheng(rs.getString("mingcheng"));
goods.setJieshao(rs.getString("jieshao"));
goods.setFujian(rs.getString("fujian"));
goods.setShichangjia(rs.getInt("shichangjia"));
goods.setTejia(rs.getInt("tejia"));
goods.setDel(rs.getString("del"));
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed();
req.setAttribute("goods", goods); // 将商品信息传递到前端页面
req.getRequestDispatcher("admin/goods/goodsPre.jsp").forward(req, res);
}
// 编辑商品信息
public void goodsEdit(HttpServletRequest req, HttpServletResponse res) {
String id = req.getParameter("id");
String catelog_id = req.getParameter("catelog_id");
String bianhao = req.getParameter("bianhao");
String mingcheng = req.getParameter("mingcheng");
String jieshao = req.getParameter("jieshao");
String fujian = req.getParameter("fujian");
int shichangjia = Integer.parseInt(req.getParameter("shichangjia"));
int tejia = Integer.parseInt(req.getParameter("shichangjia"));
// 更新商品信息
String sql = "update t_goods set catelog_id=?, bianhao=?, mingcheng=?, jieshao=?, fujian=?, shichangjia=?, tejia=? where id=?";
Object[] params = {catelog_id, bianhao, mingcheng, jieshao, fujian, shichangjia, tejia, id};
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行更新操作
mydb.closed();
req.setAttribute("msg", "操作成功");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res); // 转发到操作成功页面
}
// 获取最新商品
public void goodsNew(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
List goodsList = new ArrayList();
String sql = "select * from t_goods where del='no' order by id desc"; // 按商品ID降序排列查询所有未删除的商品
Object[] params = {};
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询操作
ResultSet rs = mydb.getRs();
while (rs.next()) {
Tgoods goods = new Tgoods(); // 创建Tgoods对象并填充数据
goods.setId(rs.getString("id"));
goods.setCatelog_id(rs.getString("catelog_id"));
goods.setBianhao(rs.getString("bianhao"));
goods.setMingcheng(rs.getString("mingcheng"));
goods.setJieshao(rs.getString("jieshao"));
goods.setFujian(rs.getString("fujian"));
goods.setShichangjia(rs.getInt("shichangjia"));
goods.setTejia(rs.getInt("tejia"));
goods.setDel(rs.getString("del"));
goodsList.add(goods); // 将商品添加到列表中
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
// 限制最新商品显示数量最多为4个
if (goodsList.size() > 4) {
goodsList = goodsList.subList(0, 4); // 截取前4个商品
}
// 将商品列表传递到前端页面
req.setAttribute("goodsList", goodsList);
req.getRequestDispatcher("site/goods/goodsNew.jsp").forward(req, res); // 转发到前端页面显示最新商品
}
// 根据商品类别查看商品
public void goodsByCatelog(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String catelog_id = req.getParameter("catelog_id");
// 从服务层获取指定类别的商品列表
req.setAttribute("goodsList", liuService.goodsByCatelog(catelog_id));
req.getRequestDispatcher("site/goods/goodsByCatelog.jsp").forward(req, res); // 转发到前端页面显示商品类别
}
// 前台查看商品详细信息
public void goodsDetailQian(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String id = req.getParameter("id");
// 从服务层获取商品的详细信息
req.setAttribute("goods", liuService.getGoods(id));
req.getRequestDispatcher("site/goods/goodsDetailQian.jsp").forward(req, res); // 转发到前端页面显示商品详细信息
}
// 根据商品名称搜索商品
public void goodsRes(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String mingcheng = req.getParameter("mingcheng");
List goodsList = new ArrayList();
String sql = "select * from t_goods where del='no' and mingcheng like '%" + mingcheng.trim() + "%'"; // 根据商品名称进行模糊查询
Object[] params = {};
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询操作
ResultSet rs = mydb.getRs();
while (rs.next()) {
Tgoods goods = new Tgoods(); // 创建Tgoods对象并填充数据
goods.setId(rs.getString("id"));
goods.setCatelog_id(rs.getString("catelog_id"));
goods.setBianhao(rs.getString("bianhao"));
goods.setMingcheng(rs.getString("mingcheng"));
goods.setJieshao(rs.getString("jieshao"));
goods.setFujian(rs.getString("fujian"));
goods.setShichangjia(rs.getInt("shichangjia"));
goods.setTejia(rs.getInt("tejia"));
goods.setDel(rs.getString("del"));
goodsList.add(goods); // 将商品添加到列表中
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
// 将商品列表传递到前端页面
req.setAttribute("goodsList", goodsList);
req.getRequestDispatcher("site/goods/goodsRes.jsp").forward(req, res); // 转发到前端页面显示搜索结果
}
// 转发请求到指定页面
public void dispatch(String targetURI, HttpServletRequest request, HttpServletResponse response) {
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try {
dispatch.forward(request, response); // 转发请求到目标页面
} catch (ServletException e) {
e.printStackTrace(); // 捕获并打印异常
} catch (IOException e) {
e.printStackTrace(); // 捕获并打印异常
}
}
// 初始化方法初始化Servlet时调用
public void init(ServletConfig config) throws ServletException {
super.init(config); // 调用父类的init()方法进行初始化
}
// 销毁方法在Servlet销毁时调用
public void destroy() {
// 在Servlet销毁时执行清理工作如果有的话
}
}

@ -0,0 +1,76 @@
package com.itbaizhan.action;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.itbaizhan.service.liuService;
public class index_servlet extends HttpServlet
// 导航页面服务端小程序
{
/**
* service
*
* 1.
* 2. session便使
* 3. index.jsp
*/
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
// 从liuService类中获取商品分类数据并将其保存到session中
req.getSession().setAttribute("catelogList", liuService.catelogList());
// 转发请求到首页index.jsp页面这个页面会使用“catelogList”来展示商品分类
req.getRequestDispatcher("site/index.jsp").forward(req, res);
}
/**
* dispatch
* URI
* URIJSP
*/
public void dispatch(String targetURI, HttpServletRequest request, HttpServletResponse response)
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI); // 获取请求转发器
try
{
// 转发请求到目标页面
dispatch.forward(request, response);
return;
}
catch (ServletException e)
{
e.printStackTrace(); // 捕获并打印ServletException
}
catch (IOException e)
{
e.printStackTrace(); // 捕获并打印IOException
}
}
/**
* initServlet
* Servlet
* init()
*/
public void init(ServletConfig config) throws ServletException
{
super.init(config); // 调用父类的init()方法进行初始化
}
/**
* destroyServlet
*
* 使
*/
public void destroy()
{
// 销毁时执行清理工作,如果需要
}
}

@ -0,0 +1,299 @@
package com.itbaizhan.action;
import java.io.IOException;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
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.itbaizhan.dao.DB;
import com.itbaizhan.orm.TLiuyan;
import com.itbaizhan.orm.Tuser;
public class liuyan_servlet extends HttpServlet
{
/**
* service
*
*/
public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
{
// 获取请求的type参数来确定操作类型
String type = req.getParameter("type");
// 根据请求的操作类型,调用相应的方法
if(type.endsWith("liuyanAdd"))
{
liuyanAdd(req, res); // 留言添加
}
if(type.endsWith("liuyanMana"))
{
liuyanMana(req, res); // 留言管理
}
if(type.endsWith("liuyanDel"))
{
liuyanDel(req, res); // 留言删除
}
if(type.endsWith("liuyanHuifu"))
{
liuyanHuifu(req, res); // 留言回复
}
if(type.endsWith("liuyanAll"))
{
liuyanAll(req, res); // 获取所有留言
}
if(type.endsWith("liuyanDetail"))
{
liuyanDetail(req, res); // 留言详细信息
}
}
/**
* liuyanAdd
*
*/
public void liuyanAdd(HttpServletRequest req,HttpServletResponse res)
{
HttpSession session = req.getSession();
Tuser user = (Tuser)session.getAttribute("user"); // 从session中获取当前登录用户
// 获取留言内容
String neirong = req.getParameter("neirong");
String liuyanshi = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()); // 当前时间
String user_id = user.getId(); // 获取用户ID
String huifu = ""; // 默认无回复
String huifushi = ""; // 默认无回复时间
// 构建SQL插入语句
String sql = "insert into t_liuyan(neirong, liuyanshi, user_id, huifu, huifushi) values(?,?,?,?,?)";
Object[] params = {neirong, liuyanshi, user_id, huifu, huifushi};
DB mydb = new DB(); // 创建DB对象
mydb.doPstm(sql, params); // 执行SQL语句
mydb.closed(); // 关闭数据库连接
req.setAttribute("msg", "留言完毕"); // 设置提示信息
String targetURL = "/common/msg.jsp"; // 定义跳转页面
dispatch(targetURL, req, res); // 请求转发到提示页面
}
/**
* liuyanMana
*
*/
public void liuyanMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List liuyanList = new ArrayList();
String sql = "select * from t_liuyan order by liuyanshi"; // 获取所有留言的SQL语句
Object[] params = {};
DB mydb = new DB(); // 创建DB对象
try
{
mydb.doPstm(sql, params); // 执行SQL查询
ResultSet rs = mydb.getRs(); // 获取结果集
while(rs.next()) // 遍历结果集
{
TLiuyan liuyan = new TLiuyan(); // 创建留言对象
liuyan.setId(rs.getInt("id"));
liuyan.setNeirong(rs.getString("neirong"));
liuyan.setLiuyanshi(rs.getString("liuyanshi"));
liuyan.setUser_id(rs.getString("user_id"));
liuyan.setHuifu(rs.getString("huifu"));
liuyan.setHuifushi(rs.getString("huifushi"));
liuyanList.add(liuyan); // 将留言添加到列表中
}
rs.close(); // 关闭结果集
}
catch(Exception e)
{
e.printStackTrace(); // 打印异常
}
mydb.closed(); // 关闭数据库连接
req.setAttribute("liuyanList", liuyanList); // 将留言列表设置到请求属性中
req.getRequestDispatcher("admin/liuyan/liuyanMana.jsp").forward(req, res); // 转发到留言管理页面
}
/**
* liuyanDelID
*
*/
public void liuyanDel(HttpServletRequest req,HttpServletResponse res)
{
String sql = "delete from t_liuyan where id=" + Integer.parseInt(req.getParameter("id")); // 删除留言的SQL语句
Object[] params = {};
DB mydb = new DB(); // 创建DB对象
mydb.doPstm(sql, params); // 执行删除操作
mydb.closed(); // 关闭数据库连接
req.setAttribute("msg", "留言信息删除完毕"); // 设置删除成功的提示信息
String targetURL = "/common/msg.jsp"; // 定义跳转页面
dispatch(targetURL, req, res); // 请求转发到提示页面
}
/**
* liuyanHuifu
*
*/
public void liuyanHuifu(HttpServletRequest req,HttpServletResponse res)
{
String huifu = req.getParameter("huifu"); // 获取回复内容
String huifushi = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()); // 回复时间
int id = Integer.parseInt(req.getParameter("id")); // 获取留言ID
// 更新留言的回复内容和时间
String sql = "update t_liuyan set huifu=?, huifushi=? where id=?";
Object[] params = {huifu, huifushi, id};
DB mydb = new DB(); // 创建DB对象
mydb.doPstm(sql, params); // 执行更新操作
mydb.closed(); // 关闭数据库连接
req.setAttribute("msg", "回复完毕"); // 设置回复成功的提示信息
String targetURL = "/common/msg.jsp"; // 定义跳转页面
dispatch(targetURL, req, res); // 请求转发到提示页面
}
/**
* liuyanAll
*
*/
public void liuyanAll(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List liuyanList = new ArrayList();
String sql = "select * from t_liuyan order by liuyanshi"; // 获取所有留言的SQL语句
Object[] params = {};
DB mydb = new DB(); // 创建DB对象
try
{
mydb.doPstm(sql, params); // 执行SQL查询
ResultSet rs = mydb.getRs(); // 获取结果集
while(rs.next()) // 遍历结果集
{
TLiuyan liuyan = new TLiuyan(); // 创建留言对象
liuyan.setId(rs.getInt("id"));
liuyan.setNeirong(rs.getString("neirong"));
liuyan.setLiuyanshi(rs.getString("liuyanshi"));
liuyan.setUser_id(rs.getString("user_id"));
liuyan.setHuifu(rs.getString("huifu"));
liuyan.setHuifushi(rs.getString("huifushi"));
liuyanList.add(liuyan); // 将留言添加到列表中
}
rs.close(); // 关闭结果集
}
catch(Exception e)
{
e.printStackTrace(); // 打印异常
}
mydb.closed(); // 关闭数据库连接
req.setAttribute("liuyanList", liuyanList); // 将留言列表设置到请求属性中
req.getRequestDispatcher("site/liuyan/liuyanAll.jsp").forward(req, res); // 转发到留言展示页面
}
/**
* liuyanDetailID
* ID
*/
public void liuyanDetail(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
int id = Integer.parseInt(req.getParameter("id")); // 获取留言ID
// 获取留言的详细信息
req.setAttribute("liuyan", get_liuyan(id));
// 转发到留言详细页面显示内容
req.getRequestDispatcher("site/liuyan/liuyanDetail.jsp").forward(req, res);
}
/**
* get_liuyanID
* @param id ID
* @return
*/
public TLiuyan get_liuyan(int id)
{
TLiuyan liuyan = new TLiuyan(); // 创建留言对象
// 查询特定ID的留言数据
String sql = "select * from t_liuyan where id=?";
Object[] params = {id};
DB mydb = new DB(); // 创建DB对象
try
{
mydb.doPstm(sql, params); // 执行SQL查询
ResultSet rs = mydb.getRs(); // 获取结果集
while(rs.next()) // 遍历结果集
{
liuyan.setId(rs.getInt("id"));
liuyan.setNeirong(rs.getString("neirong"));
liuyan.setLiuyanshi(rs.getString("liuyanshi"));
liuyan.setUser_id(rs.getString("user_id"));
liuyan.setHuifu(rs.getString("huifu"));
liuyan.setHuifushi(rs.getString("huifushi"));
}
rs.close(); // 关闭结果集
}
catch(Exception e)
{
e.printStackTrace(); // 打印异常
}
mydb.closed(); // 关闭数据库连接
return liuyan; // 返回留言对象
}
/**
* dispatch
* @param targetURI URI
* @param request
* @param response
*/
public void dispatch(String targetURI, HttpServletRequest request, HttpServletResponse response)
{
// 获取目标URI的RequestDispatcher
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try
{
dispatch.forward(request, response); // 请求转发
}
catch (ServletException e)
{
e.printStackTrace(); // 打印异常
}
catch (IOException e)
{
e.printStackTrace(); // 打印异常
}
}
/**
* initServlet
* @param config Servlet
*/
public void init(ServletConfig config) throws ServletException
{
super.init(config); // 调用父类的初始化方法
}
/**
* destroyServlet
* Servlet
*/
public void destroy()
{
// 在此方法中可以释放一些资源,如数据库连接等。
}
}

@ -0,0 +1,194 @@
package com.itbaizhan.action;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.itbaizhan.dao.DB;
import com.itbaizhan.orm.Torder;
public class order_servlet extends HttpServlet {
/**
* service(type)
* @param req HttpServletRequest
* @param res HttpServletResponse
* @throws ServletException Servlet
* @throws IOException I/O
*/
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
// 获取请求的type参数来判断要执行的操作
String type = req.getParameter("type");
if (type.endsWith("orderMana")) {
orderMana(req, res); // 订单管理
}
if (type.endsWith("orderDel")) {
orderDel(req, res); // 订单删除
}
if (type.endsWith("orderShouli")) {
orderShouli(req, res); // 受理订单
}
if (type.endsWith("huifuAdd")) {
huifuAdd(req, res); // 添加回复
}
}
/**
* orderMana
* requestJSP
* @param req HttpServletRequest
* @param res HttpServletResponse
* @throws ServletException Servlet
* @throws IOException I/O
*/
public void orderMana(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
List orderList = new ArrayList(); // 用来保存订单列表
String sql = "select * from t_order order by zhuangtai desc"; // 查询所有订单,按状态倒序排列
Object[] params = {}; // SQL语句参数当前查询没有参数
DB mydb = new DB(); // 创建DB对象来操作数据库
try {
mydb.doPstm(sql, params); // 执行SQL查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) {
Torder order = new Torder(); // 创建Torder对象来封装每一条订单数据
// 从结果集中提取每个字段的值并设置到Torder对象中
order.setId(rs.getString("id"));
order.setBianhao(rs.getString("bianhao"));
order.setShijian(rs.getString("shijian"));
order.setZhuangtai(rs.getString("zhuangtai"));
order.setHuifu(rs.getString("huifu"));
order.setSonghuodizhi(rs.getString("songhuodizhi"));
order.setFukuanfangshi(rs.getString("fukuanfangshi"));
order.setJine(rs.getInt("jine"));
order.setUser_id(rs.getString("user_id"));
// 将订单添加到订单列表
orderList.add(order);
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace(); // 捕获异常并打印堆栈信息
}
mydb.closed(); // 关闭数据库连接
// 将订单列表保存到request中以便JSP页面进行展示
req.setAttribute("orderList", orderList);
req.getRequestDispatcher("admin/order/orderMana.jsp").forward(req, res); // 请求转发到订单管理页面
}
/**
* orderDelID
* @param req HttpServletRequest
* @param res HttpServletResponse
* @throws ServletException Servlet
* @throws IOException I/O
*/
public void orderDel(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String id = req.getParameter("id"); // 获取要删除订单的ID
// 编写SQL语句删除指定ID的订单
String sql = "delete from t_order where id=?";
Object[] params = { id }; // 设置参数为订单ID
DB mydb = new DB(); // 创建DB对象
mydb.doPstm(sql, params); // 执行删除操作
mydb.closed(); // 关闭数据库连接
// 设置删除成功的消息,并转发到消息页面显示
req.setAttribute("msg", "信息删除完毕");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}
/**
* orderShouli
* @param req HttpServletRequest
* @param res HttpServletResponse
* @throws ServletException Servlet
* @throws IOException I/O
*/
public void orderShouli(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String id = req.getParameter("id"); // 获取要受理的订单ID
// 编写SQL语句更新订单的状态为"yes"(已受理)
String sql = "update t_order set zhuangtai='yes' where id=?";
Object[] params = { id }; // 设置参数为订单ID
DB mydb = new DB(); // 创建DB对象
mydb.doPstm(sql, params); // 执行更新操作
mydb.closed(); // 关闭数据库连接
// 设置受理成功的消息,并转发到消息页面显示
req.setAttribute("msg", "订单受理完毕");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}
/**
* huifuAdd
* @param req HttpServletRequest
* @param res HttpServletResponse
* @throws ServletException Servlet
* @throws IOException I/O
*/
public void huifuAdd(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String id = req.getParameter("id"); // 获取订单ID
String huifu = req.getParameter("huifu"); // 获取回复内容
// 编写SQL语句更新订单的回复内容
String sql = "update t_order set huifu=? where id=?";
Object[] params = { huifu, id }; // 设置参数为回复内容和订单ID
DB mydb = new DB(); // 创建DB对象
mydb.doPstm(sql, params); // 执行更新操作
mydb.closed(); // 关闭数据库连接
// 设置回复成功的消息,并转发到消息页面显示
req.setAttribute("msg", "操作成功");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}
/**
* dispatch
* @param targetURI URI
* @param request
* @param response
*/
public void dispatch(String targetURI, HttpServletRequest request, HttpServletResponse response) {
// 获取目标URI的RequestDispatcher
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try {
dispatch.forward(request, response); // 执行请求转发
} catch (ServletException e) {
e.printStackTrace(); // 捕获并打印异常
} catch (IOException e) {
e.printStackTrace(); // 捕获并打印异常
}
}
/**
* initServlet
* @param config Servlet
*/
public void init(ServletConfig config) throws ServletException {
super.init(config); // 调用父类的初始化方法
}
/**
* destroyServlet
* Servlet
*/
public void destroy() {
// 在此方法中可以释放一些资源,如数据库连接等
}
}

@ -0,0 +1,234 @@
package com.itbaizhan.action;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
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.itbaizhan.dao.DB;
import com.itbaizhan.orm.Tuser;
import com.itbaizhan.service.liuService;
public class user_servlet extends HttpServlet {
/**
* service(type)
* @param req HttpServletRequest
* @param res HttpServletResponse
* @throws ServletException Servlet
* @throws IOException I/O
*/
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
// 获取请求的type参数来判断要执行的操作
String type = req.getParameter("type");
if (type.endsWith("userReg")) {
userReg(req, res); // 会员注册
}
if (type.endsWith("userLogout")) {
userLogout(req, res); // 会员退出
}
if (type.endsWith("userMana")) {
userMana(req, res); // 会员管理
}
if (type.endsWith("userDel")) {
userDel(req, res); // 会员删除
}
if (type.endsWith("userDetail")) {
userDetail(req, res); // 会员详细信息
}
}
/**
* userReg
*
* @param req HttpServletRequest
* @param res HttpServletResponse
*/
public void userReg(HttpServletRequest req, HttpServletResponse res) {
String id = String.valueOf(new Date().getTime()); // 使用当前时间戳作为用户ID
String loginname = req.getParameter("loginname"); // 获取用户名
String loginpw = req.getParameter("loginpw"); // 获取密码
String name = req.getParameter("name"); // 获取用户姓名
String del = "no"; // 设置删除标志为"no"表示用户没有被删除
// 检查账号是否已经被占用
String s = liuService.panduan_zhanghao(loginname);
if (s.equals("yizhan")) {
// 如果账号已经被占用,返回提示信息
req.setAttribute("message", "账号已被占用,请输入其他账号");
req.setAttribute("path", "site/userreg/userreg.jsp");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
} else {
// 如果账号未被占用,则执行注册操作
String sql = "insert into t_user values(?,?,?,?,?)"; // 插入新用户的SQL语句
Object[] params = {id, loginname, loginpw, name, del}; // 设置SQL语句的参数
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行插入操作
mydb.closed(); // 关闭数据库连接
// 注册成功,返回成功页面
req.setAttribute("message", "注册成功,请登录");
req.setAttribute("path", "site/default.jsp");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
}
/**
* userLogout退
* @param req HttpServletRequest
* @param res HttpServletResponse
* @throws ServletException Servlet
* @throws IOException I/O
*/
public void userLogout(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
HttpSession session = req.getSession(); // 获取当前会话
session.setAttribute("userType", null); // 清除会话中的用户类型
session.setAttribute("user", null); // 清除会话中的用户信息
// 提示用户退出成功
req.setAttribute("message", "成功退出系统");
req.setAttribute("path", "site/default.jsp");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
/**
* userMana
* @param req HttpServletRequest
* @param res HttpServletResponse
* @throws ServletException Servlet
* @throws IOException I/O
*/
public void userMana(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
List userList = new ArrayList(); // 用于保存用户信息的列表
String sql = "select * from t_user where del='no'"; // 查询所有未被删除的用户
Object[] params = {}; // SQL查询没有参数
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询操作
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) {
Tuser user = new Tuser(); // 创建Tuser对象来封装每个用户的数据
user.setId(rs.getString("id"));
user.setLoginname(rs.getString("loginname"));
user.setLoginpw(rs.getString("loginpw"));
user.setName(rs.getString("name"));
userList.add(user); // 将用户添加到列表中
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace(); // 捕获异常并打印堆栈信息
}
mydb.closed(); // 关闭数据库连接
// 将用户列表传递给JSP页面
req.setAttribute("userList", userList);
req.getRequestDispatcher("admin/user/userMana.jsp").forward(req, res);
}
/**
* userDelID
* `del`"yes"
* @param req HttpServletRequest
* @param res HttpServletResponse
* @throws ServletException Servlet
* @throws IOException I/O
*/
public void userDel(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String id = req.getParameter("id"); // 获取要删除用户的ID
String sql = "update t_user set del='yes' where id=?"; // 更新SQL语句将del字段设为"yes"
Object[] params = {id}; // 设置参数为用户ID
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行更新操作
mydb.closed(); // 关闭数据库连接
// 返回删除成功的消息
req.setAttribute("msg", "用户信息删除完毕");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}
/**
* userDetail
* @param req HttpServletRequest
* @param res HttpServletResponse
* @throws ServletException Servlet
* @throws IOException I/O
*/
public void userDetail(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String id = req.getParameter("id"); // 获取用户ID
List userList = new ArrayList(); // 用于保存用户信息的列表
String sql = "select * from t_user where id=?"; // 查询指定ID的用户
Object[] params = {id}; // 设置参数为用户ID
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询操作
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) {
Tuser user = new Tuser(); // 创建Tuser对象来封装用户数据
user.setId(rs.getString("id"));
user.setLoginname(rs.getString("loginname"));
user.setLoginpw(rs.getString("loginpw"));
user.setName(rs.getString("name"));
userList.add(user); // 将用户添加到列表中
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace(); // 捕获异常并打印堆栈信息
}
mydb.closed(); // 关闭数据库连接
// 获取用户信用信息并将数据传递给JSP页面
req.setAttribute("userList", userList);
req.setAttribute("xinyongList", liuService.getxinyongList(id));
req.getRequestDispatcher("admin/user/userDetail.jsp").forward(req, res);
}
/**
* dispatch
* @param targetURI URI
* @param request
* @param response
*/
public void dispatch(String targetURI, HttpServletRequest request, HttpServletResponse response) {
// 获取目标URI的RequestDispatcher
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI); // 获取请求转发器
try {
dispatch.forward(request, response); // 执行请求转发
return;
} catch (ServletException e) {
e.printStackTrace(); // 捕获ServletException异常并打印堆栈信息
} catch (IOException e) {
e.printStackTrace(); // 捕获IOException异常并打印堆栈信息
}
}
/**
* initServlet
* @param config ServletConfigServlet
* @throws ServletException Servlet
*/
public void init(ServletConfig config) throws ServletException {
super.init(config); // 调用父类的init方法进行初始化
}
/**
* destroyServlet
*/
public void destroy() {
// 在此方法中执行清理工作,例如关闭数据库连接等资源释放操作。
}
}

@ -0,0 +1,160 @@
package com.itbaizhan.action;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.itbaizhan.dao.DB;
import com.itbaizhan.orm.Txinyong;
public class xinyong_servlet extends HttpServlet {
/**
* servicetype
* @param req HttpServletRequest
* @param res HttpServletResponse
* @throws ServletException Servlet
* @throws IOException IO
*/
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String type = req.getParameter("type"); // 获取请求参数 type
if (type.endsWith("xinyongAdd")) {
xinyongAdd(req, res); // 调用信用添加方法
}
if (type.endsWith("xinyongMana")) {
xinyongMana(req, res); // 调用信用管理方法
}
if (type.endsWith("xinyongDel")) {
xinyongDel(req, res); // 调用信用删除方法
}
}
/**
*
* @param req HttpServletRequest
* @param res HttpServletResponse
*/
public void xinyongAdd(HttpServletRequest req, HttpServletResponse res) {
String id = String.valueOf(new Date().getTime()); // 使用当前时间戳生成唯一ID
String shuxing = req.getParameter("shuxing").trim(); // 获取信用属性
String neirong = req.getParameter("neirong").trim(); // 获取信用内容
String shijian = req.getParameter("shijian").trim(); // 获取时间
String user_id = req.getParameter("user_id").trim(); // 获取用户ID
// 插入SQL语句
String sql = "insert into t_xinyong(id, shuxing, neirong, shijian, user_id) values(?,?,?,?,?)";
Object[] params = {id, shuxing, neirong, shijian, user_id};
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行插入操作
mydb.closed(); // 关闭数据库连接
req.setAttribute("msg", "操作成功"); // 设置提示消息
String targetURL = "/common/msg.jsp"; // 跳转到提示页面
dispatch(targetURL, req, res); // 执行请求转发
}
/**
*
* @param req HttpServletRequest
* @param res HttpServletResponse
* @throws ServletException Servlet
* @throws IOException IO
*/
public void xinyongMana(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String user_id = req.getParameter("user_id").trim(); // 获取用户ID
List xinyongList = new ArrayList(); // 用于存储信用记录的列表
String sql = "select * from t_xinyong where user_id=?";
Object[] params = {user_id};
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询操作
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) {
Txinyong xinyong = new Txinyong(); // 创建信用对象
// 设置信用对象的属性
xinyong.setId(rs.getString("id"));
xinyong.setShuxing(rs.getString("shuxing"));
xinyong.setNeirong(rs.getString("neirong"));
xinyong.setShijian(rs.getString("shijian"));
xinyong.setUser_id(rs.getString("user_id"));
xinyongList.add(xinyong); // 将信用对象添加到列表中
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace(); // 捕获异常并打印堆栈信息
}
mydb.closed(); // 关闭数据库连接
req.setAttribute("xinyongList", xinyongList); // 将信用列表传递到请求中
req.getRequestDispatcher("admin/xinyong/xinyongMana.jsp").forward(req, res); // 转发请求到管理页面
}
/**
*
* @param req HttpServletRequest
* @param res HttpServletResponse
* @throws ServletException Servlet
* @throws IOException IO
*/
public void xinyongDel(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String id = req.getParameter("id").trim(); // 获取信用记录ID
String sql = "delete from t_xinyong where id=?";
Object[] params = {id};
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行删除操作
mydb.closed(); // 关闭数据库连接
req.setAttribute("msg", "操作成功"); // 设置提示消息
String targetURL = "/common/msg.jsp"; // 跳转到提示页面
dispatch(targetURL, req, res); // 执行请求转发
}
/**
*
* @param targetURI URI
* @param request HttpServletRequest
* @param response HttpServletResponse
*/
public void dispatch(String targetURI, HttpServletRequest request, HttpServletResponse response) {
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI); // 获取请求转发器
try {
dispatch.forward(request, response); // 执行转发
return;
} catch (ServletException e) {
e.printStackTrace(); // 捕获并打印ServletException异常
} catch (IOException e) {
e.printStackTrace(); // 捕获并打印IOException异常
}
}
/**
* ServletServlet
* @param config ServletConfigServlet
* @throws ServletException Servlet
*/
public void init(ServletConfig config) throws ServletException {
super.init(config); // 调用父类的init方法进行初始化
}
/**
* ServletServlet
*
*/
public void destroy() {
// 在此方法中执行清理工作,例如释放数据库连接等
}
}

@ -0,0 +1,124 @@
package com.itbaizhan.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class DB {
private Connection con; // 用于数据库连接的Connection对象
private PreparedStatement pstm; // 用于执行SQL语句的PreparedStatement对象
private String user = "root"; // 数据库连接的用户名
private String password = "root"; // 数据库连接的密码
private String className = "com.mysql.cj.jdbc.Driver"; // MySQL数据库的JDBC驱动类名
private String url = "jdbc:mysql://localhost:3306/db_dingcan?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8"; // 数据库URL包含数据库名、字符编码、时区等配置
/**
*
*/
public DB() {
try {
// 加载MySQL JDBC驱动程序
Class.forName(className);
} catch (ClassNotFoundException e) {
System.out.println("加载数据库驱动失败!");
e.printStackTrace();
}
}
/**
*
* @return Connection
*/
public Connection getCon() {
try {
// 通过DriverManager获取数据库连接
con = DriverManager.getConnection(url, user, password);
} catch (SQLException e) {
System.out.println("创建数据库连接失败!");
con = null; // 如果连接失败设置con为null
e.printStackTrace();
}
return con;
}
/**
*
* @param sql SQL
* @param params SQL
*/
public void doPstm(String sql, Object[] params) {
// 如果SQL语句不为空
if (sql != null && !sql.equals("")) {
// 如果参数为空,则初始化为空数组
if (params == null) {
params = new Object[0]; // 初始化参数为空数组
}
// 获取数据库连接
getCon();
if (con != null) {
try {
System.out.println(sql); // 打印执行的SQL语句方便调试
// 创建PreparedStatement对象传入SQL语句
pstm = con.prepareStatement(sql,
ResultSet.TYPE_SCROLL_INSENSITIVE, // 结果集类型:不敏感,不会因为数据库的变化而更新
ResultSet.CONCUR_READ_ONLY); // 结果集:只读
// 设置SQL语句中的参数
for (int i = 0; i < params.length; i++) {
pstm.setObject(i + 1, params[i]); // 设定PreparedStatement对象的参数
}
// 执行SQL语句
pstm.execute(); // 执行语句,增、删、改操作
} catch (SQLException e) {
System.out.println("doPstm()方法出错!");
e.printStackTrace();
}
}
}
}
/**
*
* @return ResultSet
* @throws SQLException SQL
*/
public ResultSet getRs() throws SQLException {
return pstm.getResultSet(); // 获取PreparedStatement对象的查询结果集
}
/**
*
* @return int
* @throws SQLException SQL
*/
public int getCount() throws SQLException {
return pstm.getUpdateCount(); // 获取更新操作影响的记录数(如插入、更新、删除的行数)
}
/**
* PreparedStatement
*/
public void closed() {
try {
if (pstm != null) {
pstm.close(); // 关闭PreparedStatement对象
}
} catch (SQLException e) {
System.out.println("关闭pstm对象失败");
e.printStackTrace();
}
try {
if (con != null) {
con.close(); // 关闭数据库连接
}
} catch (SQLException e) {
System.out.println("关闭con对象失败");
e.printStackTrace();
}
}
}

@ -1,188 +0,0 @@
var tcolor={
cColor:"#EEEEEE", //蒙皮颜色
bColor:"#FFFFFF", //背景颜色
tColor:"#9C9E9C", //标题背景颜色,边框颜色
wColor:"#FFFFFF" //标题文字颜色
};
function popclose()
{
var a = parent.document.getElementById("dialogBoxClose");
a.click();
}
if(!Array.prototype.push){
Array.prototype.push=function(){
var startLength=this.length;
for(var i=0;i<arguments.length;i++)
this[startLength+i]=arguments[i];
return this.length;
}
};
function G(){
//alert("aa");
var elements=new Array();
for(var i=0;i<arguments.length;i++){
var element=arguments[i];
if(typeof element=='string')
element=document.getElementById(element);
if(arguments.length==1)
return element;elements.push(element)
};
return elements
};
Function.prototype.bind=function(object){
var __method=this;
return function(){__method.apply(object,arguments)}
};
Function.prototype.bindAsEventListener=function(object){
var __method=this;
return function(event){__method.call(object,event||window.event)}
};
Object.extend=function(destination,source){
for(property in source){destination[property]=source[property]};return destination
};
if(!window.Event){var Event=new Object()};
Object.extend(Event,{observers:false,element:function(event){return event.target||event.srcElement},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)))},pointerX:function(event){return event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))},pointerY:function(event){return event.pageY||(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop))},stop:function(event){if(event.preventDefault){event.preventDefault();event.stopPropagation()}else{event.returnValue=false;event.cancelBubble=true}},findElement:function(event,tagName){var element=Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase())))element=element.parentNode;return element},_observeAndCache:function(element,name,observer,useCapture){if(!this.observers)this.observers=[];if(element.addEventListener){this.observers.push([element,name,observer,useCapture]);element.addEventListener(name,observer,useCapture)}else if(element.attachEvent){this.observers.push([element,name,observer,useCapture]);element.attachEvent('on'+name,observer)}},unloadCache:function(){if(!Event.observers)return;for(var i=0;i<Event.observers.length;i++){Event.stopObserving.apply(this,Event.observers[i]);Event.observers[i][0]=null};Event.observers=false},observe:function(element,name,observer,useCapture){var element=G(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent))name='keydown';this._observeAndCache(element,name,observer,useCapture)},stopObserving:function(element,name,observer,useCapture){var element=G(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent))name='keydown';if(element.removeEventListener){element.removeEventListener(name,observer,useCapture)}else if(element.detachEvent){element.detachEvent('on'+name,observer)}}});
Event.observe(window,'unload',Event.unloadCache,false);
var Class=function(){
var _class=function(){
this.initialize.apply(this,arguments)
};
for(i=0;i<arguments.length;i++){
superClass=arguments[i];for(member in superClass.prototype){_class.prototype[member]=superClass.prototype[member]}
};
_class.child=function(){return new Class(this)};
_class.extend=function(f){for(property in f){_class.prototype[property]=f[property]}};
return _class
};
function space(flag){
if(flag=="begin"){
var ele=document.getElementById("ft");
if(typeof(ele)!="undefined"&&ele!=null)
ele.id="ft_popup";
ele=document.getElementById("usrbar");
if(typeof(ele)!="undefined"&&ele!=null)
ele.id="usrbar_popup"
}
else if(flag=="end"){
var ele=document.getElementById("ft_popup");
if(typeof(ele)!="undefined"&&ele!=null)ele.id="ft";
ele=document.getElementById("usrbar_popup");
if(typeof(ele)!="undefined"&&ele!=null)ele.id="usrbar"}
};
// Popup Class begin....
var Popup=new Class();
Popup.prototype={
iframeIdName:'ifr_popup', //iframe的名字
initialize:function(config){
this.config=Object.extend({ //属性设置
contentType:1, //pop类型 1. 内嵌iframe2. 显示给定的html 3. confirm框 4. alert框
isHaveTitle:true, //是否有标题栏
scrollType:'yes', //内嵌iframe是否可以滚动
isBackgroundCanClick:false, //背景是否可以点击
isSupportDraging:true, //是否支持拖动
isShowShadow:true, //是否显示阴影
isReloadOnClose:true, //关闭后是否重新加载页面
width:400, //宽度
height:300 //高度
},config||{});
this.info={ //参数
shadowWidth:0, //阴影宽度
title:"", //标题
contentUrl:"", //iframe的url
contentHtml:"", //内容的html
callBack:null, //回调函数
parameter:null, //调用的参数 如 {id:"divCall",str:"点击确定后显示的字符串",obj:pop}
confirmCon:"", //confirm的内容
alertCon:"", //alert的内容
someHiddenTag:"select,object,embed", //自动隐藏的页面元素
someDisabledBtn:"", //禁用的btn
someHiddenEle:"", //隐藏的匀速
overlay:0, //覆盖
coverOpacity:0 //蒙皮不透明度
};
this.color=tcolor;
this.dropClass=null;
this.someToHidden=[];
this.someToDisabled=[];
if(!this.config.isHaveTitle)
this.config.isSupportDraging=false;
this.iniBuild()
},
setContent:function(arrt,val){ //设置内容,即 this.info 的参数内容
if(val!=''){
switch(arrt){
case 'width':this.config.width=val;break;
case 'height':this.config.height=val;break;
case 'title':this.info.title=val;break;
case 'contentUrl':this.info.contentUrl=val;break;
case 'contentHtml':this.info.contentHtml=val;break;
case 'callBack':this.info.callBack=val;break;
case 'parameter':this.info.parameter=val;break;
case 'confirmCon':this.info.confirmCon=val;break;
case 'alertCon':this.info.alertCon=val;break;
case 'someHiddenTag':this.info.someHiddenTag=val;break;
case 'someHiddenEle':this.info.someHiddenEle=val;break;
case 'someDisabledBtn':this.info.someDisabledBtn=val;break;
case 'overlay':this.info.overlay=val}
}
},
iniBuild:function(){
G('dialogCase')?G('dialogCase').parentNode.removeChild(G('dialogCase')):function(){};
var oDiv=document.createElement('span');oDiv.id='dialogCase';document.body.appendChild(oDiv)
},
build:function(){
var baseZIndex=10001+this.info.overlay*10;
var showZIndex=baseZIndex+2;this.iframeIdName='ifr_popup'+this.info.overlay;
//关闭按钮
//var path="http://img.baidu.com/hi/img/";
//var close='<input type="image" id="dialogBoxClose" src="'+path+'dialogclose.gif" border="0" width="16" height="16" align="absmiddle" title="关闭"/>';
var close='<img id="dialogBoxClose" title="关闭" src=/dingcan/images/dialogclose.gif />';
var cB='filter: alpha(opacity='+this.info.coverOpacity+');opacity:'+this.info.coverOpacity/100+';';
var cover='<div id="dialogBoxBG" style="position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:'+baseZIndex+';'+cB+'background-color:'+this.color.cColor+';display:none;"></div>';
var mainBox='<div id="dialogBox" style="border:1px solid '+this.color.tColor+';display:none;z-index:'+showZIndex+';position:relative;width:'+this.config.width+'px;"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="'+this.color.bColor+'">';if(this.config.isHaveTitle){mainBox+='<tr height="24" bgcolor="'+this.color.tColor+'"><td><table style="-moz-user-select:none;height:24px;" width="100%" border="0" cellpadding="0" cellspacing="0" ><tr>'+'<td width="6" height="24"></td><td id="dialogBoxTitle" style="color:'+this.color.wColor+';font-size:14px;font-weight:bold;">'+this.info.title+'&nbsp;</td>'+'<td id="dialogClose" width="20" align="right" valign="middle">'+close+'</td><td width="6"></td></tr></table></td></tr>'}
else{mainBox+='<tr height="10"><td align="right">'+close+'</td></tr>'};
mainBox+='<tr style="height:'+this.config.height+'px" valign="top"><td id="dialogBody" style="position:relative;"></td></tr></table></div>'+'<div id="dialogBoxShadow" style="display:none;z-index:'+baseZIndex+';"></div>';
if(!this.config.isBackgroundCanClick){G('dialogCase').innerHTML=cover+mainBox;G('dialogBoxBG').style.height=document.body.scrollHeight}
else G('dialogCase').innerHTML=mainBox;Event.observe(G('dialogBoxClose'),"click",this.reset.bindAsEventListener(this),false);
if(this.config.isSupportDraging){dropClass=new Dragdrop(this.config.width,this.config.height,this.info.shadowWidth,this.config.isSupportDraging,this.config.contentType);G("dialogBoxTitle").style.cursor="move"};this.lastBuild()},lastBuild:function(){var confirm='<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;">'+this.info.confirmCon+'</div><div style="margin:20px;"><input id="dialogOk" type="button" value=" 确定 "/>&nbsp;<input id="dialogCancel" type="button" value=" 取消 "/></div></div>';
var alert='<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;">'+this.info.alertCon+'</div><div style="margin:20px;"><input id="dialogYES" type="button" value=" 确定 "/></div></div>';
var baseZIndex=10001+this.info.overlay*10;var coverIfZIndex=baseZIndex+4;
if(this.config.contentType==1){var openIframe="<iframe width='100%' style='height:"+this.config.height+"px' name='"+this.iframeIdName+"' id='"+this.iframeIdName+"' src='"+this.info.contentUrl+"' frameborder='0' scrolling='"+this.config.scrollType+"'></iframe>";
var coverIframe="<div id='iframeBG' style='position:absolute;top:0px;left:0px;width:1px;height:1px;z-index:"+coverIfZIndex+";filter: alpha(opacity=00);opacity:0.00;background-color:#ffffff;'><div>";G("dialogBody").innerHTML=openIframe+coverIframe}
else if(this.config.contentType==2){G("dialogBody").innerHTML=this.info.contentHtml}else if(this.config.contentType==3){G("dialogBody").innerHTML=confirm;Event.observe(G('dialogOk'),"click",this.forCallback.bindAsEventListener(this),false);
Event.observe(G('dialogCancel'),"click",this.close.bindAsEventListener(this),false)}else if(this.config.contentType==4){G("dialogBody").innerHTML=alert;Event.observe(G('dialogYES'),"click",this.close.bindAsEventListener(this),false)}},reBuild:function(){G('dialogBody').height=G('dialogBody').clientHeight;this.lastBuild()},show:function(){this.hiddenSome();this.middle();if(this.config.isShowShadow)this.shadow()},forCallback:function(){return this.info.callBack(this.info.parameter)},shadow:function(){var oShadow=G('dialogBoxShadow');var oDialog=G('dialogBox');oShadow['style']['position']="absolute";oShadow['style']['background']="#000";oShadow['style']['display']="";oShadow['style']['opacity']="0.2";oShadow['style']['filter']="alpha(opacity=20)";oShadow['style']['top']=oDialog.offsetTop+this.info.shadowWidth;oShadow['style']['left']=oDialog.offsetLeft+this.info.shadowWidth;oShadow['style']['width']=oDialog.offsetWidth;oShadow['style']['height']=oDialog.offsetHeight},middle:function(){if(!this.config.isBackgroundCanClick)G('dialogBoxBG').style.display='';
var oDialog=G('dialogBox');
oDialog['style']['position']="absolute";
oDialog['style']['display']='';
//取得页面的宽度和高度
var sClientWidth=document.body.clientWidth;
var sClientHeight=document.body.clientHeight;
var sScrollTop=document.body.scrollTop;
//
var sleft=(sClientWidth/2)-(oDialog.offsetWidth/2);
var iTop=-80+(sClientHeight/2+sScrollTop)-(oDialog.offsetHeight/2);
var sTop=iTop>0?iTop:(sClientHeight/2+sScrollTop)-(oDialog.offsetHeight/2);
if(sTop<1)sTop="20";if(sleft<1)sleft="20";
oDialog['style']['left']=sleft+"px"; //左侧位置
oDialog['style']['top']=220+"px" //顶部位置
},
reset:function(){if(this.config.isReloadOnClose){top.location.reload()};this.close()},close:function(){G('dialogBox').style.display='none';
if(!this.config.isBackgroundCanClick)G('dialogBoxBG').style.display='none';
if(this.config.isShowShadow)G('dialogBoxShadow').style.display='none';G('dialogBody').innerHTML='';
this.showSome()},hiddenSome:function(){var tag=this.info.someHiddenTag.split(",");
if(tag.length==1&&tag[0]=="")tag.length=0;
for(var i=0;i<tag.length;i++){this.hiddenTag(tag[i])};
var ids=this.info.someHiddenEle.split(",");
if(ids.length==1&&ids[0]=="")ids.length=0;
for(var i=0;i<ids.length;i++){this.hiddenEle(ids[i])};
var ids=this.info.someDisabledBtn.split(",");
if(ids.length==1&&ids[0]=="")ids.length=0;
for(var i=0;i<ids.length;i++){this.disabledBtn(ids[i])};
space("begin")},disabledBtn:function(id){var ele=document.getElementById(id);
if(typeof(ele)!="undefined"&&ele!=null&&ele.disabled==false){ele.disabled=true;this.someToDisabled.push(ele)}},hiddenTag:function(tagName){var ele=document.getElementsByTagName(tagName);
if(ele!=null){for(var i=0;i<ele.length;i++){if(ele[i].style.display!="none"&&ele[i].style.visibility!='hidden'){ele[i].style.visibility='hidden';this.someToHidden.push(ele[i])}}}},hiddenEle:function(id){var ele=document.getElementById(id);if(typeof(ele)!="undefined"&&ele!=null){ele.style.visibility='hidden';this.someToHidden.push(ele)}},showSome:function(){for(var i=0;i<this.someToHidden.length;i++){this.someToHidden[i].style.visibility='visible'};for(var i=0;i<this.someToDisabled.length;i++){this.someToDisabled[i].disabled=false};space("end")}};var Dragdrop=new Class();Dragdrop.prototype={initialize:function(width,height,shadowWidth,showShadow,contentType){this.dragData=null;this.dragDataIn=null;this.backData=null;this.width=width;this.height=height;this.shadowWidth=shadowWidth;this.showShadow=showShadow;this.contentType=contentType;this.IsDraging=false;this.oObj=G('dialogBox');Event.observe(G('dialogBoxTitle'),"mousedown",this.moveStart.bindAsEventListener(this),false)},moveStart:function(event){this.IsDraging=true;if(this.contentType==1){G("iframeBG").style.display="";G("iframeBG").style.width=this.width;G("iframeBG").style.height=this.height};Event.observe(document,"mousemove",this.mousemove.bindAsEventListener(this),false);Event.observe(document,"mouseup",this.mouseup.bindAsEventListener(this),false);Event.observe(document,"selectstart",this.returnFalse,false);this.dragData={x:Event.pointerX(event),y:Event.pointerY(event)};this.backData={x:parseInt(this.oObj.style.left),y:parseInt(this.oObj.style.top)}},mousemove:function(event){if(!this.IsDraging)return;var iLeft=Event.pointerX(event)-this.dragData["x"]+parseInt(this.oObj.style.left);var iTop=Event.pointerY(event)-this.dragData["y"]+parseInt(this.oObj.style.top);if(this.dragData["y"]<parseInt(this.oObj.style.top))iTop=iTop-12;else if(this.dragData["y"]>parseInt(this.oObj.style.top)+25)iTop=iTop+12;this.oObj.style.left=iLeft;this.oObj.style.top=iTop;if(this.showShadow){G('dialogBoxShadow').style.left=iLeft+this.shadowWidth;G('dialogBoxShadow').style.top=iTop+this.shadowWidth};this.dragData={x:Event.pointerX(event),y:Event.pointerY(event)};document.body.style.cursor="move"},mouseup:function(event){if(!this.IsDraging)return;if(this.contentType==1)G("iframeBG").style.display="none";document.onmousemove=null;document.onmouseup=null;var mousX=Event.pointerX(event)-(document.documentElement.scrollLeft||document.body.scrollLeft);var mousY=Event.pointerY(event)-(document.documentElement.scrollTop||document.body.scrollTop);if(mousX<1||mousY<1||mousX>document.body.clientWidth||mousY>document.body.clientHeight){this.oObj.style.left=this.backData["x"];this.oObj.style.top=this.backData["y"];if(this.showShadow){G('dialogBoxShadow').style.left=this.backData.x+this.shadowWidth;G('dialogBoxShadow').style.top=this.backData.y+this.shadowWidth}};this.IsDraging=false;document.body.style.cursor="";Event.stopObserving(document,"selectstart",this.returnFalse,false)},returnFalse:function(){return false}};

@ -1,188 +0,0 @@
var tcolor={
cColor:"#EEEEEE", //蒙皮颜色
bColor:"#FFFFFF", //背景颜色
tColor:"#9C9E9C", //标题背景颜色,边框颜色
wColor:"#FFFFFF" //标题文字颜色
};
function popclose()
{
var a = parent.document.getElementById("dialogBoxClose");
a.click();
}
if(!Array.prototype.push){
Array.prototype.push=function(){
var startLength=this.length;
for(var i=0;i<arguments.length;i++)
this[startLength+i]=arguments[i];
return this.length;
}
};
function G(){
//alert("aa");
var elements=new Array();
for(var i=0;i<arguments.length;i++){
var element=arguments[i];
if(typeof element=='string')
element=document.getElementById(element);
if(arguments.length==1)
return element;elements.push(element)
};
return elements
};
Function.prototype.bind=function(object){
var __method=this;
return function(){__method.apply(object,arguments)}
};
Function.prototype.bindAsEventListener=function(object){
var __method=this;
return function(event){__method.call(object,event||window.event)}
};
Object.extend=function(destination,source){
for(property in source){destination[property]=source[property]};return destination
};
if(!window.Event){var Event=new Object()};
Object.extend(Event,{observers:false,element:function(event){return event.target||event.srcElement},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)))},pointerX:function(event){return event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))},pointerY:function(event){return event.pageY||(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop))},stop:function(event){if(event.preventDefault){event.preventDefault();event.stopPropagation()}else{event.returnValue=false;event.cancelBubble=true}},findElement:function(event,tagName){var element=Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase())))element=element.parentNode;return element},_observeAndCache:function(element,name,observer,useCapture){if(!this.observers)this.observers=[];if(element.addEventListener){this.observers.push([element,name,observer,useCapture]);element.addEventListener(name,observer,useCapture)}else if(element.attachEvent){this.observers.push([element,name,observer,useCapture]);element.attachEvent('on'+name,observer)}},unloadCache:function(){if(!Event.observers)return;for(var i=0;i<Event.observers.length;i++){Event.stopObserving.apply(this,Event.observers[i]);Event.observers[i][0]=null};Event.observers=false},observe:function(element,name,observer,useCapture){var element=G(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent))name='keydown';this._observeAndCache(element,name,observer,useCapture)},stopObserving:function(element,name,observer,useCapture){var element=G(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent))name='keydown';if(element.removeEventListener){element.removeEventListener(name,observer,useCapture)}else if(element.detachEvent){element.detachEvent('on'+name,observer)}}});
Event.observe(window,'unload',Event.unloadCache,false);
var Class=function(){
var _class=function(){
this.initialize.apply(this,arguments)
};
for(i=0;i<arguments.length;i++){
superClass=arguments[i];for(member in superClass.prototype){_class.prototype[member]=superClass.prototype[member]}
};
_class.child=function(){return new Class(this)};
_class.extend=function(f){for(property in f){_class.prototype[property]=f[property]}};
return _class
};
function space(flag){
if(flag=="begin"){
var ele=document.getElementById("ft");
if(typeof(ele)!="undefined"&&ele!=null)
ele.id="ft_popup";
ele=document.getElementById("usrbar");
if(typeof(ele)!="undefined"&&ele!=null)
ele.id="usrbar_popup"
}
else if(flag=="end"){
var ele=document.getElementById("ft_popup");
if(typeof(ele)!="undefined"&&ele!=null)ele.id="ft";
ele=document.getElementById("usrbar_popup");
if(typeof(ele)!="undefined"&&ele!=null)ele.id="usrbar"}
};
// Popup Class begin....
var Popup=new Class();
Popup.prototype={
iframeIdName:'ifr_popup', //iframe的名字
initialize:function(config){
this.config=Object.extend({ //属性设置
contentType:1, //pop类型 1. 内嵌iframe2. 显示给定的html 3. confirm框 4. alert框
isHaveTitle:true, //是否有标题栏
scrollType:'yes', //内嵌iframe是否可以滚动
isBackgroundCanClick:false, //背景是否可以点击
isSupportDraging:true, //是否支持拖动
isShowShadow:true, //是否显示阴影
isReloadOnClose:true, //关闭后是否重新加载页面
width:400, //宽度
height:300 //高度
},config||{});
this.info={ //参数
shadowWidth:0, //阴影宽度
title:"", //标题
contentUrl:"", //iframe的url
contentHtml:"", //内容的html
callBack:null, //回调函数
parameter:null, //调用的参数 如 {id:"divCall",str:"点击确定后显示的字符串",obj:pop}
confirmCon:"", //confirm的内容
alertCon:"", //alert的内容
someHiddenTag:"select,object,embed", //自动隐藏的页面元素
someDisabledBtn:"", //禁用的btn
someHiddenEle:"", //隐藏的匀速
overlay:0, //覆盖
coverOpacity:0 //蒙皮不透明度
};
this.color=tcolor;
this.dropClass=null;
this.someToHidden=[];
this.someToDisabled=[];
if(!this.config.isHaveTitle)
this.config.isSupportDraging=false;
this.iniBuild()
},
setContent:function(arrt,val){ //设置内容,即 this.info 的参数内容
if(val!=''){
switch(arrt){
case 'width':this.config.width=val;break;
case 'height':this.config.height=val;break;
case 'title':this.info.title=val;break;
case 'contentUrl':this.info.contentUrl=val;break;
case 'contentHtml':this.info.contentHtml=val;break;
case 'callBack':this.info.callBack=val;break;
case 'parameter':this.info.parameter=val;break;
case 'confirmCon':this.info.confirmCon=val;break;
case 'alertCon':this.info.alertCon=val;break;
case 'someHiddenTag':this.info.someHiddenTag=val;break;
case 'someHiddenEle':this.info.someHiddenEle=val;break;
case 'someDisabledBtn':this.info.someDisabledBtn=val;break;
case 'overlay':this.info.overlay=val}
}
},
iniBuild:function(){
G('dialogCase')?G('dialogCase').parentNode.removeChild(G('dialogCase')):function(){};
var oDiv=document.createElement('span');oDiv.id='dialogCase';document.body.appendChild(oDiv)
},
build:function(){
var baseZIndex=10001+this.info.overlay*10;
var showZIndex=baseZIndex+2;this.iframeIdName='ifr_popup'+this.info.overlay;
//关闭按钮
//var path="http://img.baidu.com/hi/img/";
//var close='<input type="image" id="dialogBoxClose" src="'+path+'dialogclose.gif" border="0" width="16" height="16" align="absmiddle" title="关闭"/>';
var close='<img id="dialogBoxClose" title="关闭" src=/dingcan/images/dialogclose.gif />';
var cB='filter: alpha(opacity='+this.info.coverOpacity+');opacity:'+this.info.coverOpacity/100+';';
var cover='<div id="dialogBoxBG" style="position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:'+baseZIndex+';'+cB+'background-color:'+this.color.cColor+';display:none;"></div>';
var mainBox='<div id="dialogBox" style="border:1px solid '+this.color.tColor+';display:none;z-index:'+showZIndex+';position:relative;width:'+this.config.width+'px;"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="'+this.color.bColor+'">';if(this.config.isHaveTitle){mainBox+='<tr height="24" bgcolor="'+this.color.tColor+'"><td><table style="-moz-user-select:none;height:24px;" width="100%" border="0" cellpadding="0" cellspacing="0" ><tr>'+'<td width="6" height="24"></td><td id="dialogBoxTitle" style="color:'+this.color.wColor+';font-size:14px;font-weight:bold;">'+this.info.title+'&nbsp;</td>'+'<td id="dialogClose" width="20" align="right" valign="middle">'+close+'</td><td width="6"></td></tr></table></td></tr>'}
else{mainBox+='<tr height="10"><td align="right">'+close+'</td></tr>'};
mainBox+='<tr style="height:'+this.config.height+'px" valign="top"><td id="dialogBody" style="position:relative;"></td></tr></table></div>'+'<div id="dialogBoxShadow" style="display:none;z-index:'+baseZIndex+';"></div>';
if(!this.config.isBackgroundCanClick){G('dialogCase').innerHTML=cover+mainBox;G('dialogBoxBG').style.height=document.body.scrollHeight}
else G('dialogCase').innerHTML=mainBox;Event.observe(G('dialogBoxClose'),"click",this.reset.bindAsEventListener(this),false);
if(this.config.isSupportDraging){dropClass=new Dragdrop(this.config.width,this.config.height,this.info.shadowWidth,this.config.isSupportDraging,this.config.contentType);G("dialogBoxTitle").style.cursor="move"};this.lastBuild()},lastBuild:function(){var confirm='<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;">'+this.info.confirmCon+'</div><div style="margin:20px;"><input id="dialogOk" type="button" value=" 确定 "/>&nbsp;<input id="dialogCancel" type="button" value=" 取消 "/></div></div>';
var alert='<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;">'+this.info.alertCon+'</div><div style="margin:20px;"><input id="dialogYES" type="button" value=" 确定 "/></div></div>';
var baseZIndex=10001+this.info.overlay*10;var coverIfZIndex=baseZIndex+4;
if(this.config.contentType==1){var openIframe="<iframe width='100%' style='height:"+this.config.height+"px' name='"+this.iframeIdName+"' id='"+this.iframeIdName+"' src='"+this.info.contentUrl+"' frameborder='0' scrolling='"+this.config.scrollType+"'></iframe>";
var coverIframe="<div id='iframeBG' style='position:absolute;top:0px;left:0px;width:1px;height:1px;z-index:"+coverIfZIndex+";filter: alpha(opacity=00);opacity:0.00;background-color:#ffffff;'><div>";G("dialogBody").innerHTML=openIframe+coverIframe}
else if(this.config.contentType==2){G("dialogBody").innerHTML=this.info.contentHtml}else if(this.config.contentType==3){G("dialogBody").innerHTML=confirm;Event.observe(G('dialogOk'),"click",this.forCallback.bindAsEventListener(this),false);
Event.observe(G('dialogCancel'),"click",this.close.bindAsEventListener(this),false)}else if(this.config.contentType==4){G("dialogBody").innerHTML=alert;Event.observe(G('dialogYES'),"click",this.close.bindAsEventListener(this),false)}},reBuild:function(){G('dialogBody').height=G('dialogBody').clientHeight;this.lastBuild()},show:function(){this.hiddenSome();this.middle();if(this.config.isShowShadow)this.shadow()},forCallback:function(){return this.info.callBack(this.info.parameter)},shadow:function(){var oShadow=G('dialogBoxShadow');var oDialog=G('dialogBox');oShadow['style']['position']="absolute";oShadow['style']['background']="#000";oShadow['style']['display']="";oShadow['style']['opacity']="0.2";oShadow['style']['filter']="alpha(opacity=20)";oShadow['style']['top']=oDialog.offsetTop+this.info.shadowWidth;oShadow['style']['left']=oDialog.offsetLeft+this.info.shadowWidth;oShadow['style']['width']=oDialog.offsetWidth;oShadow['style']['height']=oDialog.offsetHeight},middle:function(){if(!this.config.isBackgroundCanClick)G('dialogBoxBG').style.display='';
var oDialog=G('dialogBox');
oDialog['style']['position']="absolute";
oDialog['style']['display']='';
//取得页面的宽度和高度
var sClientWidth=document.body.clientWidth;
var sClientHeight=document.body.clientHeight;
var sScrollTop=document.body.scrollTop;
//
var sleft=(sClientWidth/2)-(oDialog.offsetWidth/2);
var iTop=-80+(sClientHeight/2+sScrollTop)-(oDialog.offsetHeight/2);
var sTop=iTop>0?iTop:(sClientHeight/2+sScrollTop)-(oDialog.offsetHeight/2);
if(sTop<1)sTop="20";if(sleft<1)sleft="20";
oDialog['style']['left']=sleft+"px"; //左侧位置
oDialog['style']['top']=220+"px" //顶部位置
},
reset:function(){if(this.config.isReloadOnClose){top.location.reload()};this.close()},close:function(){G('dialogBox').style.display='none';window.location.reload();
if(!this.config.isBackgroundCanClick)G('dialogBoxBG').style.display='none';
if(this.config.isShowShadow)G('dialogBoxShadow').style.display='none';G('dialogBody').innerHTML='';
this.showSome()},hiddenSome:function(){var tag=this.info.someHiddenTag.split(",");
if(tag.length==1&&tag[0]=="")tag.length=0;
for(var i=0;i<tag.length;i++){this.hiddenTag(tag[i])};
var ids=this.info.someHiddenEle.split(",");
if(ids.length==1&&ids[0]=="")ids.length=0;
for(var i=0;i<ids.length;i++){this.hiddenEle(ids[i])};
var ids=this.info.someDisabledBtn.split(",");
if(ids.length==1&&ids[0]=="")ids.length=0;
for(var i=0;i<ids.length;i++){this.disabledBtn(ids[i])};
space("begin")},disabledBtn:function(id){var ele=document.getElementById(id);
if(typeof(ele)!="undefined"&&ele!=null&&ele.disabled==false){ele.disabled=true;this.someToDisabled.push(ele)}},hiddenTag:function(tagName){var ele=document.getElementsByTagName(tagName);
if(ele!=null){for(var i=0;i<ele.length;i++){if(ele[i].style.display!="none"&&ele[i].style.visibility!='hidden'){ele[i].style.visibility='hidden';this.someToHidden.push(ele[i])}}}},hiddenEle:function(id){var ele=document.getElementById(id);if(typeof(ele)!="undefined"&&ele!=null){ele.style.visibility='hidden';this.someToHidden.push(ele)}},showSome:function(){for(var i=0;i<this.someToHidden.length;i++){this.someToHidden[i].style.visibility='visible'};for(var i=0;i<this.someToDisabled.length;i++){this.someToDisabled[i].disabled=false};space("end")}};var Dragdrop=new Class();Dragdrop.prototype={initialize:function(width,height,shadowWidth,showShadow,contentType){this.dragData=null;this.dragDataIn=null;this.backData=null;this.width=width;this.height=height;this.shadowWidth=shadowWidth;this.showShadow=showShadow;this.contentType=contentType;this.IsDraging=false;this.oObj=G('dialogBox');Event.observe(G('dialogBoxTitle'),"mousedown",this.moveStart.bindAsEventListener(this),false)},moveStart:function(event){this.IsDraging=true;if(this.contentType==1){G("iframeBG").style.display="";G("iframeBG").style.width=this.width;G("iframeBG").style.height=this.height};Event.observe(document,"mousemove",this.mousemove.bindAsEventListener(this),false);Event.observe(document,"mouseup",this.mouseup.bindAsEventListener(this),false);Event.observe(document,"selectstart",this.returnFalse,false);this.dragData={x:Event.pointerX(event),y:Event.pointerY(event)};this.backData={x:parseInt(this.oObj.style.left),y:parseInt(this.oObj.style.top)}},mousemove:function(event){if(!this.IsDraging)return;var iLeft=Event.pointerX(event)-this.dragData["x"]+parseInt(this.oObj.style.left);var iTop=Event.pointerY(event)-this.dragData["y"]+parseInt(this.oObj.style.top);if(this.dragData["y"]<parseInt(this.oObj.style.top))iTop=iTop-12;else if(this.dragData["y"]>parseInt(this.oObj.style.top)+25)iTop=iTop+12;this.oObj.style.left=iLeft;this.oObj.style.top=iTop;if(this.showShadow){G('dialogBoxShadow').style.left=iLeft+this.shadowWidth;G('dialogBoxShadow').style.top=iTop+this.shadowWidth};this.dragData={x:Event.pointerX(event),y:Event.pointerY(event)};document.body.style.cursor="move"},mouseup:function(event){if(!this.IsDraging)return;if(this.contentType==1)G("iframeBG").style.display="none";document.onmousemove=null;document.onmouseup=null;var mousX=Event.pointerX(event)-(document.documentElement.scrollLeft||document.body.scrollLeft);var mousY=Event.pointerY(event)-(document.documentElement.scrollTop||document.body.scrollTop);if(mousX<1||mousY<1||mousX>document.body.clientWidth||mousY>document.body.clientHeight){this.oObj.style.left=this.backData["x"];this.oObj.style.top=this.backData["y"];if(this.showShadow){G('dialogBoxShadow').style.left=this.backData.x+this.shadowWidth;G('dialogBoxShadow').style.top=this.backData.y+this.shadowWidth}};this.IsDraging=false;document.body.style.cursor="";Event.stopObserving(document,"selectstart",this.returnFalse,false)},returnFalse:function(){return false}};

@ -1,188 +0,0 @@
var tcolor={
cColor:"#EEEEEE", //蒙皮颜色
bColor:"#FFFFFF", //背景颜色
tColor:"#9C9E9C", //标题背景颜色,边框颜色
wColor:"#FFFFFF" //标题文字颜色
};
function popclose()
{
var a = parent.document.getElementById("dialogBoxClose");
a.click();
}
if(!Array.prototype.push){
Array.prototype.push=function(){
var startLength=this.length;
for(var i=0;i<arguments.length;i++)
this[startLength+i]=arguments[i];
return this.length;
}
};
function G(){
//alert("aa");
var elements=new Array();
for(var i=0;i<arguments.length;i++){
var element=arguments[i];
if(typeof element=='string')
element=document.getElementById(element);
if(arguments.length==1)
return element;elements.push(element)
};
return elements
};
Function.prototype.bind=function(object){
var __method=this;
return function(){__method.apply(object,arguments)}
};
Function.prototype.bindAsEventListener=function(object){
var __method=this;
return function(event){__method.call(object,event||window.event)}
};
Object.extend=function(destination,source){
for(property in source){destination[property]=source[property]};return destination
};
if(!window.Event){var Event=new Object()};
Object.extend(Event,{observers:false,element:function(event){return event.target||event.srcElement},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)))},pointerX:function(event){return event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))},pointerY:function(event){return event.pageY||(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop))},stop:function(event){if(event.preventDefault){event.preventDefault();event.stopPropagation()}else{event.returnValue=false;event.cancelBubble=true}},findElement:function(event,tagName){var element=Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase())))element=element.parentNode;return element},_observeAndCache:function(element,name,observer,useCapture){if(!this.observers)this.observers=[];if(element.addEventListener){this.observers.push([element,name,observer,useCapture]);element.addEventListener(name,observer,useCapture)}else if(element.attachEvent){this.observers.push([element,name,observer,useCapture]);element.attachEvent('on'+name,observer)}},unloadCache:function(){if(!Event.observers)return;for(var i=0;i<Event.observers.length;i++){Event.stopObserving.apply(this,Event.observers[i]);Event.observers[i][0]=null};Event.observers=false},observe:function(element,name,observer,useCapture){var element=G(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent))name='keydown';this._observeAndCache(element,name,observer,useCapture)},stopObserving:function(element,name,observer,useCapture){var element=G(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent))name='keydown';if(element.removeEventListener){element.removeEventListener(name,observer,useCapture)}else if(element.detachEvent){element.detachEvent('on'+name,observer)}}});
Event.observe(window,'unload',Event.unloadCache,false);
var Class=function(){
var _class=function(){
this.initialize.apply(this,arguments)
};
for(i=0;i<arguments.length;i++){
superClass=arguments[i];for(member in superClass.prototype){_class.prototype[member]=superClass.prototype[member]}
};
_class.child=function(){return new Class(this)};
_class.extend=function(f){for(property in f){_class.prototype[property]=f[property]}};
return _class
};
function space(flag){
if(flag=="begin"){
var ele=document.getElementById("ft");
if(typeof(ele)!="undefined"&&ele!=null)
ele.id="ft_popup";
ele=document.getElementById("usrbar");
if(typeof(ele)!="undefined"&&ele!=null)
ele.id="usrbar_popup"
}
else if(flag=="end"){
var ele=document.getElementById("ft_popup");
if(typeof(ele)!="undefined"&&ele!=null)ele.id="ft";
ele=document.getElementById("usrbar_popup");
if(typeof(ele)!="undefined"&&ele!=null)ele.id="usrbar"}
};
// Popup Class begin....
var Popup=new Class();
Popup.prototype={
iframeIdName:'ifr_popup', //iframe的名字
initialize:function(config){
this.config=Object.extend({ //属性设置
contentType:1, //pop类型 1. 内嵌iframe2. 显示给定的html 3. confirm框 4. alert框
isHaveTitle:true, //是否有标题栏
scrollType:'yes', //内嵌iframe是否可以滚动
isBackgroundCanClick:false, //背景是否可以点击
isSupportDraging:true, //是否支持拖动
isShowShadow:true, //是否显示阴影
isReloadOnClose:true, //关闭后是否重新加载页面
width:400, //宽度
height:300 //高度
},config||{});
this.info={ //参数
shadowWidth:0, //阴影宽度
title:"", //标题
contentUrl:"", //iframe的url
contentHtml:"", //内容的html
callBack:null, //回调函数
parameter:null, //调用的参数 如 {id:"divCall",str:"点击确定后显示的字符串",obj:pop}
confirmCon:"", //confirm的内容
alertCon:"", //alert的内容
someHiddenTag:"select,object,embed", //自动隐藏的页面元素
someDisabledBtn:"", //禁用的btn
someHiddenEle:"", //隐藏的匀速
overlay:0, //覆盖
coverOpacity:0 //蒙皮不透明度
};
this.color=tcolor;
this.dropClass=null;
this.someToHidden=[];
this.someToDisabled=[];
if(!this.config.isHaveTitle)
this.config.isSupportDraging=false;
this.iniBuild()
},
setContent:function(arrt,val){ //设置内容,即 this.info 的参数内容
if(val!=''){
switch(arrt){
case 'width':this.config.width=val;break;
case 'height':this.config.height=val;break;
case 'title':this.info.title=val;break;
case 'contentUrl':this.info.contentUrl=val;break;
case 'contentHtml':this.info.contentHtml=val;break;
case 'callBack':this.info.callBack=val;break;
case 'parameter':this.info.parameter=val;break;
case 'confirmCon':this.info.confirmCon=val;break;
case 'alertCon':this.info.alertCon=val;break;
case 'someHiddenTag':this.info.someHiddenTag=val;break;
case 'someHiddenEle':this.info.someHiddenEle=val;break;
case 'someDisabledBtn':this.info.someDisabledBtn=val;break;
case 'overlay':this.info.overlay=val}
}
},
iniBuild:function(){
G('dialogCase')?G('dialogCase').parentNode.removeChild(G('dialogCase')):function(){};
var oDiv=document.createElement('span');oDiv.id='dialogCase';document.body.appendChild(oDiv)
},
build:function(){
var baseZIndex=10001+this.info.overlay*10;
var showZIndex=baseZIndex+2;this.iframeIdName='ifr_popup'+this.info.overlay;
//关闭按钮
//var path="http://img.baidu.com/hi/img/";
//var close='<input type="image" id="dialogBoxClose" src="'+path+'dialogclose.gif" border="0" width="16" height="16" align="absmiddle" title="关闭"/>';
var close='<img id="dialogBoxClose" title="关闭" src=/dingcan/images/dialogclose.gif />';
var cB='filter: alpha(opacity='+this.info.coverOpacity+');opacity:'+this.info.coverOpacity/100+';';
var cover='<div id="dialogBoxBG" style="position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:'+baseZIndex+';'+cB+'background-color:'+this.color.cColor+';display:none;"></div>';
var mainBox='<div id="dialogBox" style="border:1px solid '+this.color.tColor+';display:none;z-index:'+showZIndex+';position:relative;width:'+this.config.width+'px;"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="'+this.color.bColor+'">';if(this.config.isHaveTitle){mainBox+='<tr height="24" bgcolor="'+this.color.tColor+'"><td><table style="-moz-user-select:none;height:24px;" width="100%" border="0" cellpadding="0" cellspacing="0" ><tr>'+'<td width="6" height="24"></td><td id="dialogBoxTitle" style="color:'+this.color.wColor+';font-size:14px;font-weight:bold;">'+this.info.title+'&nbsp;</td>'+'<td id="dialogClose" width="20" align="right" valign="middle">'+close+'</td><td width="6"></td></tr></table></td></tr>'}
else{mainBox+='<tr height="10"><td align="right">'+close+'</td></tr>'};
mainBox+='<tr style="height:'+this.config.height+'px" valign="top"><td id="dialogBody" style="position:relative;"></td></tr></table></div>'+'<div id="dialogBoxShadow" style="display:none;z-index:'+baseZIndex+';"></div>';
if(!this.config.isBackgroundCanClick){G('dialogCase').innerHTML=cover+mainBox;G('dialogBoxBG').style.height=document.body.scrollHeight}
else G('dialogCase').innerHTML=mainBox;Event.observe(G('dialogBoxClose'),"click",this.reset.bindAsEventListener(this),false);
if(this.config.isSupportDraging){dropClass=new Dragdrop(this.config.width,this.config.height,this.info.shadowWidth,this.config.isSupportDraging,this.config.contentType);G("dialogBoxTitle").style.cursor="move"};this.lastBuild()},lastBuild:function(){var confirm='<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;">'+this.info.confirmCon+'</div><div style="margin:20px;"><input id="dialogOk" type="button" value=" 确定 "/>&nbsp;<input id="dialogCancel" type="button" value=" 取消 "/></div></div>';
var alert='<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;">'+this.info.alertCon+'</div><div style="margin:20px;"><input id="dialogYES" type="button" value=" 确定 "/></div></div>';
var baseZIndex=10001+this.info.overlay*10;var coverIfZIndex=baseZIndex+4;
if(this.config.contentType==1){var openIframe="<iframe width='100%' style='height:"+this.config.height+"px' name='"+this.iframeIdName+"' id='"+this.iframeIdName+"' src='"+this.info.contentUrl+"' frameborder='0' scrolling='"+this.config.scrollType+"'></iframe>";
var coverIframe="<div id='iframeBG' style='position:absolute;top:0px;left:0px;width:1px;height:1px;z-index:"+coverIfZIndex+";filter: alpha(opacity=00);opacity:0.00;background-color:#ffffff;'><div>";G("dialogBody").innerHTML=openIframe+coverIframe}
else if(this.config.contentType==2){G("dialogBody").innerHTML=this.info.contentHtml}else if(this.config.contentType==3){G("dialogBody").innerHTML=confirm;Event.observe(G('dialogOk'),"click",this.forCallback.bindAsEventListener(this),false);
Event.observe(G('dialogCancel'),"click",this.close.bindAsEventListener(this),false)}else if(this.config.contentType==4){G("dialogBody").innerHTML=alert;Event.observe(G('dialogYES'),"click",this.close.bindAsEventListener(this),false)}},reBuild:function(){G('dialogBody').height=G('dialogBody').clientHeight;this.lastBuild()},show:function(){this.hiddenSome();this.middle();if(this.config.isShowShadow)this.shadow()},forCallback:function(){return this.info.callBack(this.info.parameter)},shadow:function(){var oShadow=G('dialogBoxShadow');var oDialog=G('dialogBox');oShadow['style']['position']="absolute";oShadow['style']['background']="#000";oShadow['style']['display']="";oShadow['style']['opacity']="0.2";oShadow['style']['filter']="alpha(opacity=20)";oShadow['style']['top']=oDialog.offsetTop+this.info.shadowWidth;oShadow['style']['left']=oDialog.offsetLeft+this.info.shadowWidth;oShadow['style']['width']=oDialog.offsetWidth;oShadow['style']['height']=oDialog.offsetHeight},middle:function(){if(!this.config.isBackgroundCanClick)G('dialogBoxBG').style.display='';
var oDialog=G('dialogBox');
oDialog['style']['position']="absolute";
oDialog['style']['display']='';
//取得页面的宽度和高度
var sClientWidth=document.body.clientWidth;
var sClientHeight=document.body.clientHeight;
var sScrollTop=document.body.scrollTop;
//
var sleft=(sClientWidth/2)-(oDialog.offsetWidth/2);
var iTop=-80+(sClientHeight/2+sScrollTop)-(oDialog.offsetHeight/2);
var sTop=iTop>0?iTop:(sClientHeight/2+sScrollTop)-(oDialog.offsetHeight/2);
if(sTop<1)sTop="20";if(sleft<1)sleft="20";
oDialog['style']['left']=sleft+"px"; //左侧位置
oDialog['style']['top']=220+"px" //顶部位置
},
reset:function(){if(this.config.isReloadOnClose){top.location.reload()};this.close()},close:function(){G('dialogBox').style.display='none';
if(!this.config.isBackgroundCanClick)G('dialogBoxBG').style.display='none';
if(this.config.isShowShadow)G('dialogBoxShadow').style.display='none';G('dialogBody').innerHTML='';
this.showSome()},hiddenSome:function(){var tag=this.info.someHiddenTag.split(",");
if(tag.length==1&&tag[0]=="")tag.length=0;
for(var i=0;i<tag.length;i++){this.hiddenTag(tag[i])};
var ids=this.info.someHiddenEle.split(",");
if(ids.length==1&&ids[0]=="")ids.length=0;
for(var i=0;i<ids.length;i++){this.hiddenEle(ids[i])};
var ids=this.info.someDisabledBtn.split(",");
if(ids.length==1&&ids[0]=="")ids.length=0;
for(var i=0;i<ids.length;i++){this.disabledBtn(ids[i])};
space("begin")},disabledBtn:function(id){var ele=document.getElementById(id);
if(typeof(ele)!="undefined"&&ele!=null&&ele.disabled==false){ele.disabled=true;this.someToDisabled.push(ele)}},hiddenTag:function(tagName){var ele=document.getElementsByTagName(tagName);
if(ele!=null){for(var i=0;i<ele.length;i++){if(ele[i].style.display!="none"&&ele[i].style.visibility!='hidden'){ele[i].style.visibility='hidden';this.someToHidden.push(ele[i])}}}},hiddenEle:function(id){var ele=document.getElementById(id);if(typeof(ele)!="undefined"&&ele!=null){ele.style.visibility='hidden';this.someToHidden.push(ele)}},showSome:function(){for(var i=0;i<this.someToHidden.length;i++){this.someToHidden[i].style.visibility='visible'};for(var i=0;i<this.someToDisabled.length;i++){this.someToDisabled[i].disabled=false};space("end")}};var Dragdrop=new Class();Dragdrop.prototype={initialize:function(width,height,shadowWidth,showShadow,contentType){this.dragData=null;this.dragDataIn=null;this.backData=null;this.width=width;this.height=height;this.shadowWidth=shadowWidth;this.showShadow=showShadow;this.contentType=contentType;this.IsDraging=false;this.oObj=G('dialogBox');Event.observe(G('dialogBoxTitle'),"mousedown",this.moveStart.bindAsEventListener(this),false)},moveStart:function(event){this.IsDraging=true;if(this.contentType==1){G("iframeBG").style.display="";G("iframeBG").style.width=this.width;G("iframeBG").style.height=this.height};Event.observe(document,"mousemove",this.mousemove.bindAsEventListener(this),false);Event.observe(document,"mouseup",this.mouseup.bindAsEventListener(this),false);Event.observe(document,"selectstart",this.returnFalse,false);this.dragData={x:Event.pointerX(event),y:Event.pointerY(event)};this.backData={x:parseInt(this.oObj.style.left),y:parseInt(this.oObj.style.top)}},mousemove:function(event){if(!this.IsDraging)return;var iLeft=Event.pointerX(event)-this.dragData["x"]+parseInt(this.oObj.style.left);var iTop=Event.pointerY(event)-this.dragData["y"]+parseInt(this.oObj.style.top);if(this.dragData["y"]<parseInt(this.oObj.style.top))iTop=iTop-12;else if(this.dragData["y"]>parseInt(this.oObj.style.top)+25)iTop=iTop+12;this.oObj.style.left=iLeft;this.oObj.style.top=iTop;if(this.showShadow){G('dialogBoxShadow').style.left=iLeft+this.shadowWidth;G('dialogBoxShadow').style.top=iTop+this.shadowWidth};this.dragData={x:Event.pointerX(event),y:Event.pointerY(event)};document.body.style.cursor="move"},mouseup:function(event){if(!this.IsDraging)return;if(this.contentType==1)G("iframeBG").style.display="none";document.onmousemove=null;document.onmouseup=null;var mousX=Event.pointerX(event)-(document.documentElement.scrollLeft||document.body.scrollLeft);var mousY=Event.pointerY(event)-(document.documentElement.scrollTop||document.body.scrollTop);if(mousX<1||mousY<1||mousX>document.body.clientWidth||mousY>document.body.clientHeight){this.oObj.style.left=this.backData["x"];this.oObj.style.top=this.backData["y"];if(this.showShadow){G('dialogBoxShadow').style.left=this.backData.x+this.shadowWidth;G('dialogBoxShadow').style.top=this.backData.y+this.shadowWidth}};this.IsDraging=false;document.body.style.cursor="";Event.stopObserving(document,"selectstart",this.returnFalse,false)},returnFalse:function(){return false}};

@ -1,474 +0,0 @@
/*
* 打开新窗口 f:链接地址 n:窗口的名称 w:窗口的宽度 h:窗口的高度 s:窗口是否有滚动条1有滚动条0没有滚动条
*/
function openWin(f, n, w, h, s)
{
var result=window.open(f,n,"dialogHeight:"+h+";dialogWidth:"+w+";"+s);
if(result==true)
{
window.location.reload(true);
}
else
{
//window.location.reload(true);
}
}
/*
* 删除记录
*/
function del(url, info)
{
//if (openDeleteDialog(url, info))
//{
//window.location.reload(true);
//}
if (confirm(info))
{
var result=window.open(url,"window123","dialogHeight:234px;dialogWidth:271px;resizable:no;help:no;status:no;scroll:no");
if(result==true)
{
window.location.reload(true);
}
else
{
}
}
else
{
}
}
/*
* 校验checkbox
*/
function checkAll(chkName, checkboxName, pageSize) {
var src = event.srcElement;
var chkN = eval("document.all." + chkName);
if (src.checked) {
chkN[0].checked = true;
chkN[1].checked = true;
for (var i = 0; i < pageSize; i++) {
var chk = eval("document.all." + checkboxName + i);
if (chk) {
chk.checked = true;
}
}
} else {
chkN[0].checked = false;
chkN[1].checked = false;
for (var i = 0; i < pageSize; i++) {
var chk = eval("document.all." + checkboxName + i);
if (chk) {
chk.checked = false;
}
}
}
}
/*
*
*/
function makePages(maxPage, selectedPage, selectName) {
var sel = eval("document.all." + selectName);
sel.length = 0;
for (var i = 1; i <= maxPage; i++) {
sel.options[i] = new Option(i, i);
if (sel.options[i] == selectedPage) {
sel.options[i].selected = true;
}
}
}
/*
* 替换字符串
*/
function replaceStr(str) {
var re = "/( )/gi";
str = str.replace(re, "");
re = "/\</gi";
str = str.replace(re, "&lt;");
return str;
}
/*
* 去掉左边空格
*/
function LTrim(str) {
var whitespace = new String(" \t\n\r");
var s = new String(str);
if (whitespace.indexOf(s.charAt(0)) != -1) {
var j = 0, i = s.length;
while (j < i && whitespace.indexOf(s.charAt(j)) != -1) {
j++;
}
s = s.substring(j, i);
}
return s;
}
/*
* 去掉右边空格
*/
function RTrim(str) {
var whitespace = new String(" \t\n\r");
var s = new String(str);
if (whitespace.indexOf(s.charAt(s.length - 1)) != -1) {
var i = s.length - 1;
while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) {
i--;
}
s = s.substring(0, i + 1);
}
return s;
}
/*
* 去掉两边空格
*/
function Trim(str) {
return RTrim(LTrim(str));
}
/*
*
*/
function exeOperation(exePath) {
var obj = new ActiveXObject("Microsoft.XMLHTTP");
obj.open("post", exePath, false);
obj.send();
var res = obj.responseText;
var rs = Trim(res);
if (rs.indexOf('true', 0) != -1) {
return true;
} else {
return false;
}
}
/*
*
*/
function exeValidate(exePath) {
var obj = new ActiveXObject("Microsoft.XMLHTTP");
obj.open("post", exePath, false);
obj.send();
var res = obj.responseText;
var rs = Trim(res);
if (rs.indexOf('validate_login_user', 0) != -1) {
return true;
} else {
return false;
}
}
/*
* 显示
*/
function validate_date(exePath) {
var obj = new ActiveXObject("Microsoft.XMLHTTP");
obj.open("post", exePath, false);
obj.send();
var res = obj.responseText;
var rs = Trim(res);
var begin_str = "<!--begin-->";
var beginIndex = rs.indexOf(begin_str) + begin_str.length;
var endIndex = rs.indexOf("<!--end-->");
rs = ((beginIndex >= 0) && (endIndex >= 0)) ? rs.substring(beginIndex,
endIndex) : "";
return Trim(rs);
}
/*
* 校验是否数字
*/
function checkNumber(name, TempS) {
for (Count = 0; Count < TempS.length; Count++) {
TempChar = TempS.substring(Count, Count + 1);
RefString = "0123456789";
if (RefString.indexOf(TempChar, 0) == -1) {
alert("请输入数字");
eval("document.all." + name).focus();
return false;
}
}
}
/*
* 是否有非法字符
*/
function chksafe(a) {
fibdn = new Array("'", "\\");
i = fibdn.length;
j = a.length;
for (ii = 0; ii < i; ii++) {
for (jj = 0; jj < j; jj++) {
temp1 = a.charAt(jj);
temp2 = fibdn[ii];
if (temp1 == temp2) {
return false;
}
}
}
return true;
}
/*
*
*/
function fucCheckNUM(NUM) {
var i, j, strTemp;
strTemp = "0123456789";
if (NUM.length == 0)
return false;
for (i = 0; i < NUM.length; i++) {
j = strTemp.indexOf(NUM.charAt(i));
if (j == -1) {
return false;
}
}
return true;
}
/*
*
*/
function fucCheckLength(strTemp) {
var i, sum;
sum = 0;
for (i = 0; i < strTemp.length; i++) {
if ((strTemp.charCodeAt(i) >= 0) && (strTemp.charCodeAt(i) <= 255)) {
sum = sum + 1;
} else {
sum = sum + 2;
}
}
return sum;
}
/*
*
*/
function chkElements(name, errMsg, max_length, lengthMsg) {
var el_name = eval("document.all." + name);
var v = el_name.value;
if (!chksafe(v)) {
el_name.focus();
alert(errMsg);
return false;
} else if (fucCheckLength(v) > max_length) {
el_name.focus();
alert(lengthMsg);
return false;
}
return true;
}
/*
* 校验空字符串
*/
function checkNullStr(name, msg) {
var el_name = eval("document.all." + name);
if (Trim(el_name.value).length == 0) {
alert(msg);
el_name.focus();
return false;
}
return true;
}
/*
* 显示日期控jian
*/
function GetDate(nText, para) {
var v_url = para == "1" ? "./common/data.html" : "../../common/data.html";
var reVal = window
.open(
v_url,
'data',
"status:no;center:yes;scroll:no;resizable:no;dialogWidth:255px;dialogHeight:260px");
if (reVal != null) {
var n = eval("document.all." + nText);
n.value = reVal;
}
}
/*
* 按比例缩小图片
*/
function DrawImage(ImgD, iwidth, iheight) {
var flag = false;
var image = new Image();
image.src = ImgD.src;
if (image.width > 0 && image.height > 0) {
flag = true;
if (image.width / image.height >= iwidth / iheight) {
if (image.width > iwidth) {
ImgD.width = iwidth;
ImgD.height = (image.height * iwidth) / image.width;
} else {
ImgD.width = image.width;
ImgD.height = image.height;
}
// ImgD.alt=image.width+"×"+image.height;
} else {
if (image.height > iheight) {
ImgD.height = iheight;
ImgD.width = (image.width * iheight) / image.height;
} else {
ImgD.width = image.width;
ImgD.height = image.height;
}
// ImgD.alt=image.width+"×"+image.height;
}
}
ImgD.style.visibility = "visible";
}
/*
* 回车键转为Tab键
*/
function enterTab() {
if (event.keyCode == 13) {
oElement = document.activeElement;
if (oElement.tagName != "TEXTAREA" && oElement.type != "button")
event.keyCode = 9;
return;
}
}
/*
*
*/
function objectEval(text) {
text = text.replace(/\n/g, " ");
text = text.replace(/\r/g, " ");
if (text.match(/^\s*\{.*\}\s*$/)) {
text = "[" + text + "]";
}
return eval(text)[0];
}
/*
* 打开领导查询页面 action - 查询的Action method - 调用的方法 title - 标题message name -
* 员工选择域的name
*/
function openLeaderQuery(action, method, title, name) {
openWin("../../common/selectStaff.jsp?action=" + action + "&method="
+ method + "&title=" + title + "&name=" + name,
"public_leader_find_page", "400", "150");
}
/*
* 第一行变色
*/
function chgColor() {
var v_table = document.all["PowerTable"];
var v_row = v_table.rows[1];
var len = v_row.cells.length;
for (var i = 0; i < len; i++) {
var v_cell = v_row.cells[i];
v_cell.style.backgroundColor = "yellow";
}
}
/*
* 第一行变色
*/
function chgColor2() {
var v_table = document.all["PowerTable"];
var rows_count = v_table.rows.length;
var v_row, v_cell, temp_len, len;
var rowspan = 0;
// get rowspan
if (v_table.rows.length > 1) {
len = v_table.rows[1].cells.length;
for (var r = 2; r < rows_count; r++) {
v_row = v_table.rows[r];
temp_len = v_row.cells.length;
if (temp_len == len) {
rowspan = r - 1;
break;
}
}
rowspan = (rowspan > 0) ? (rowspan + 1) : rows_count;
for (var r = 1; r < rowspan; r++) {
v_row = v_table.rows[r];
for (var t = 0; t < v_row.cells.length; t++) {
v_cell = v_row.cells[t];
v_cell.style.backgroundColor = "yellow";
}
}
}
}
/*
* 添加页面载入后触发的shijian
*/
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof(window.onload) != "function") {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
// adsName:名称,adsUrl:地址,sTime:时间(小时) add by wujie 2005.12.12
function PopAds(adsName, adsUrl, sTime, number, w, h, s) {
if (document.cookie.indexOf(adsName) == -1) {
window.open(adsUrl, adsName);
self.focus();
var expireDate = new Date();
var lefttime = 1000 * (3600 * sTime);
expireDate.setTime(expireDate.getTime() + lefttime);
document.cookie = adsName + "=yes" + "; expires="
+ expireDate.toGMTString() + ";";
}
openWin(adsUrl, number, w, h, s);
}

@ -0,0 +1,38 @@
package com.itbaizhan.orm;
public class TAdmin { // 管理员类
private int userId; // 管理员用户ID
private String userName; // 管理员用户名
private String userPw; // 管理员密码
// 得到管理员用户名
public String getUserName() {
return userName;
}
// 设置管理员用户名
public void setUserName(String userName) {
this.userName = userName;
}
// 得到管理员密码
public String getUserPw() {
return userPw;
}
// 设置管理员密码
public void setUserPw(String userPw) {
this.userPw = userPw;
}
// 得到管理员用户ID
public int getUserId() {
return userId;
}
// 设置管理员用户ID
public void setUserId(int userId) {
this.userId = userId;
}
}

@ -0,0 +1,146 @@
package com.itbaizhan.orm;
/**
* TLiuyan -
*
*
*
*/
public class TLiuyan implements java.io.Serializable {
private Integer id; // 留言ID唯一标识每一条留言
private String neirong; // 留言内容,用户输入的留言文本
private String liuyanshi; // 留言时间,记录用户留言的时间
private String user_id; // 用户ID标识留言所属的用户
private String huifu; // 回复内容,管理员或用户对留言的回复
private String huifushi; // 回复时间,记录回复的时间
private Tuser user; // 用户信息关联留言所属的用户对象Tuser
/**
*
*
* @return
*/
public String getHuifu() {
return huifu;
}
/**
*
*
* @param huifu
*/
public void setHuifu(String huifu) {
this.huifu = huifu;
}
/**
*
*
* @return
*/
public String getHuifushi() {
return huifushi;
}
/**
*
*
* @param huifushi
*/
public void setHuifushi(String huifushi) {
this.huifushi = huifushi;
}
/**
* ID
*
* @return ID
*/
public Integer getId() {
return id;
}
/**
* ID
*
* @param id ID
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*
* @return
*/
public String getLiuyanshi() {
return liuyanshi;
}
/**
*
*
* @param liuyanshi
*/
public void setLiuyanshi(String liuyanshi) {
this.liuyanshi = liuyanshi;
}
/**
*
*
* @return
*/
public String getNeirong() {
return neirong;
}
/**
*
*
* @param neirong
*/
public void setNeirong(String neirong) {
this.neirong = neirong;
}
/**
*
*
* @return Tuser
*/
public Tuser getUser() {
return user;
}
/**
*
*
* @param user Tuser
*/
public void setUser(Tuser user) {
this.user = user;
}
/**
* ID
*
* @return ID
*/
public String getUser_id() {
return user_id;
}
/**
* ID
*
* @param user_id ID
*/
public void setUser_id(String user_id) {
this.user_id = user_id;
}
}

@ -0,0 +1,34 @@
package com.itbaizhan.orm;
public class Tcatelog //菜品类别类
{
private String id;//菜品类别ID
private String name;//菜品类别名称
private String del;//菜品类别是否删除标志
public String getDel()//得到是否删除信息
{
return del;
}
public void setDel(String del)//设置是否删除信息
{
this.del = del;
}
public String getName()//得到菜品类别名信息
{
return name;
}
public void setName(String name)//设置菜品类别名信息
{
this.name = name;
}
public String getId()//得到菜品类别ID信息
{
return id;
}
public void setId(String id)//设置菜品类别ID信息
{
this.id = id;
}
}

@ -0,0 +1,104 @@
package com.itbaizhan.orm;
public class Tgoods { // 菜品信息类
private String id; // 菜品的ID
private String catelog_id; // 菜品类别的ID
private String bianhao; // 菜品的编号
private String mingcheng; // 菜品的名称
private String jieshao; // 菜品的介绍
private String fujian; // 菜品的图片
private int shichangjia; // 菜品的市场价
private int tejia; // 菜品的特价
private String del; // 菜品是否删除标志
// 获取菜品编号
public String getBianhao() {
return bianhao;
}
// 设置菜品编号
public void setBianhao(String bianhao) {
this.bianhao = bianhao;
}
// 获取菜品类别ID
public String getCatelog_id() {
return catelog_id;
}
// 设置菜品类别ID
public void setCatelog_id(String catelog_id) {
this.catelog_id = catelog_id;
}
// 获取菜品是否删除信息
public String getDel() {
return del;
}
// 设置菜品是否删除信息
public void setDel(String del) {
this.del = del;
}
// 获取菜品图片信息
public String getFujian() {
return fujian;
}
// 设置菜品图片信息
public void setFujian(String fujian) {
this.fujian = fujian;
}
// 获取菜品ID信息
public String getId() {
return id;
}
// 设置菜品ID信息
public void setId(String id) {
this.id = id;
}
// 获取菜品介绍信息
public String getJieshao() {
return jieshao;
}
// 设置菜品介绍信息
public void setJieshao(String jieshao) {
this.jieshao = jieshao;
}
// 获取菜品名称信息
public String getMingcheng() {
return mingcheng;
}
// 设置菜品名称信息
public void setMingcheng(String mingcheng) {
this.mingcheng = mingcheng;
}
// 获取菜品市场价信息
public int getShichangjia() {
return shichangjia;
}
// 设置菜品市场价信息
public void setShichangjia(int shichangjia) {
this.shichangjia = shichangjia;
}
// 获取菜品特价信息
public int getTejia() {
return tejia;
}
// 设置菜品特价信息
public void setTejia(int tejia) {
this.tejia = tejia;
}
}

@ -0,0 +1,186 @@
package com.itbaizhan.orm;
/**
* Torder -
*
*
* 线
*/
public class Torder implements java.io.Serializable {
private String id; // 订单ID唯一标识每一个订单
private String bianhao; // 订单编号,订单的唯一标识符(通常为系统自动生成)
private String shijian; // 下单时间,用户创建订单的时间
private String zhuangtai; // 订单状态,例如:待支付、已支付、已发货、已完成、已取消等
private String huifu; // 回复内容,可能用于管理员对订单的反馈或备注
private String songhuodizhi; // 送货地址,用户填写的送货地址
private String fukuanfangshi; // 付款方式,例如:信用卡、支付宝、现金等
private int jine = 0; // 总金额,订单的总费用
private String user_id; // 用户ID表示该订单所属的用户
/** 默认构造函数 */
public Torder() {
}
/**
*
*
* @return
*/
public String getBianhao() {
return bianhao;
}
/**
*
*
* @param bianhao
*/
public void setBianhao(String bianhao) {
this.bianhao = bianhao;
}
/**
*
*
* @return
*/
public String getFukuanfangshi() {
return fukuanfangshi;
}
/**
*
*
* @param fukuanfangshi
*/
public void setFukuanfangshi(String fukuanfangshi) {
this.fukuanfangshi = fukuanfangshi;
}
/**
* ID
*
* @return ID
*/
public String getId() {
return id;
}
/**
* ID
*
* @param id ID
*/
public void setId(String id) {
this.id = id;
}
/**
*
*
* @return
*/
public int getJine() {
return jine;
}
/**
*
*
* @return
*/
public String getHuifu() {
return huifu;
}
/**
*
*
* @param huifu
*/
public void setHuifu(String huifu) {
this.huifu = huifu;
}
/**
*
*
* @param jine
*/
public void setJine(int jine) {
this.jine = jine;
}
/**
*
*
* @return
*/
public String getShijian() {
return shijian;
}
/**
*
*
* @param shijian
*/
public void setShijian(String shijian) {
this.shijian = shijian;
}
/**
*
*
* @return
*/
public String getSonghuodizhi() {
return songhuodizhi;
}
/**
*
*
* @param songhuodizhi
*/
public void setSonghuodizhi(String songhuodizhi) {
this.songhuodizhi = songhuodizhi;
}
/**
* ID
*
* @return ID
*/
public String getUser_id() {
return user_id;
}
/**
* ID
*
* @param user_id ID
*/
public void setUser_id(String user_id) {
this.user_id = user_id;
}
/**
*
*
* @return
*/
public String getZhuangtai() {
return zhuangtai;
}
/**
*
*
* @param zhuangtai
*/
public void setZhuangtai(String zhuangtai) {
this.zhuangtai = zhuangtai;
}
}

@ -0,0 +1,107 @@
package com.itbaizhan.orm;
/**
* TorderItem -
*
* IDID
*
*/
public class TorderItem {
private String id; // 订单明细ID唯一标识每个订单明细项
private String order_id; // 订单ID表示该订单明细项所属的订单
private String goods_id; // 商品ID表示该明细项对应的商品
private int goods_quantity; // 商品数量,表示该商品在该订单中的数量
private Tgoods goods; // 商品对象,关联商品详细信息(额外的字段)
/**
*
*
* @return
*/
public int getGoods_quantity() {
return goods_quantity;
}
/**
*
*
* @param goods_quantity
*/
public void setGoods_quantity(int goods_quantity) {
this.goods_quantity = goods_quantity;
}
/**
* ID
*
* @return ID
*/
public String getGoods_id() {
return goods_id;
}
/**
* ID
*
* @param goods_id ID
*/
public void setGoods_id(String goods_id) {
this.goods_id = goods_id;
}
/**
* ID
*
* @return ID
*/
public String getId() {
return id;
}
/**
* ID
*
* @param id ID
*/
public void setId(String id) {
this.id = id;
}
/**
* ID
*
* @return ID
*/
public String getOrder_id() {
return order_id;
}
/**
* ID
*
* @param order_id ID
*/
public void setOrder_id(String order_id) {
this.order_id = order_id;
}
/**
*
*
* @return
*/
public Tgoods getGoods() {
return goods;
}
/**
*
*
* @param goods
*/
public void setGoods(Tgoods goods) {
this.goods = goods;
}
}

@ -0,0 +1,106 @@
package com.itbaizhan.orm;
/**
* Tuser -
*
*
*
*/
public class Tuser {
private String id; // 用户ID唯一标识每个用户
private String loginname; // 用户登录账号,用户用于登录系统的唯一账号
private String loginpw; // 用户登录密码,用户登录系统时输入的密码
private String name; // 用户姓名,用户的真实姓名或显示名
private String del; // 是否删除标志,表示用户是否已被删除或禁用(逻辑删除)
/**
* ID
*
* @return ID
*/
public String getId() {
return id;
}
/**
* ID
*
* @param id ID
*/
public void setId(String id) {
this.id = id;
}
/**
*
*
* @return
*/
public String getLoginname() {
return loginname;
}
/**
*
*
* @param loginname
*/
public void setLoginname(String loginname) {
this.loginname = loginname;
}
/**
*
*
* @return
*/
public String getLoginpw() {
return loginpw;
}
/**
*
*
* @param loginpw
*/
public void setLoginpw(String loginpw) {
this.loginpw = loginpw;
}
/**
*
*
* @return
*/
public String getDel() {
return del;
}
/**
*
*
* @param del
*/
public void setDel(String del) {
this.del = del;
}
/**
*
*
* @return
*/
public String getName() {
return name;
}
/**
*
*
* @param name
*/
public void setName(String name) {
this.name = name;
}
}

@ -0,0 +1,105 @@
package com.itbaizhan.orm;
/**
* Txinyong -
*
* IDID
*/
public class Txinyong {
private String id; // 评价ID唯一标识每条评价
private String shuxing; // 评价属性,管理员根据不同的标准对用户进行评价的属性(如信用、表现等)
private String neirong; // 评价内容,具体的评价文字或描述
private String shijian; // 评价时间,管理员进行评价的时间
private String user_id; // 用户ID标识被评价的用户
/**
* ID
*
* @return ID
*/
public String getId() {
return id;
}
/**
* ID
*
* @param id ID
*/
public void setId(String id) {
this.id = id;
}
/**
*
*
* @return
*/
public String getShuxing() {
return shuxing;
}
/**
*
*
* @param shuxing
*/
public void setShuxing(String shuxing) {
this.shuxing = shuxing;
}
/**
*
*
* @return
*/
public String getNeirong() {
return neirong;
}
/**
*
*
* @param neirong
*/
public void setNeirong(String neirong) {
this.neirong = neirong;
}
/**
*
*
* @return
*/
public String getShijian() {
return shijian;
}
/**
*
*
* @param shijian
*/
public void setShijian(String shijian) {
this.shijian = shijian;
}
/**
* ID
*
* @return ID
*/
public String getUser_id() {
return user_id;
}
/**
* ID
*
* @param user_id ID
*/
public void setUser_id(String user_id) {
this.user_id = user_id;
}
}

@ -0,0 +1,88 @@
package com.itbaizhan.service;
import javax.servlet.http.HttpSession;
import org.directwebremoting.WebContext;
import org.directwebremoting.WebContextFactory;
import com.itbaizhan.util.Cart;
/**
* (cartService)
*
*
* 使 session
*/
public class cartService {
/**
*
*
* @param goodsId ID
* @param quantity
* @return ("yes" )
*/
public String modiNum(String goodsId, int quantity) {
String result = ""; // 初始化操作结果为空
// 获取 WebContext 上下文
WebContext ctx = WebContextFactory.get(); // 通过 DWR (Direct Web Remoting) 获取 WebContext
HttpSession session = ctx.getSession(); // 获取当前会话对象
// 获取购物车对象
Cart cart = (Cart) session.getAttribute("cart");
// 更新购物车中的商品数量
cart.updateCart(goodsId, quantity);
// 更新 session 中的购物车对象
session.setAttribute("cart", cart);
// 设置操作结果为 "yes" 表示成功
result = "yes";
return result;
}
/**
*
*
* @param goodsId ID
* @return ("yes" )
*/
public String delGoodsFromCart(String goodsId) {
// 获取 WebContext 上下文
WebContext ctx = WebContextFactory.get(); // 通过 DWR 获取 WebContext
HttpSession session = ctx.getSession(); // 获取当前会话对象
// 获取购物车对象
Cart cart = (Cart) session.getAttribute("cart");
// 从购物车中删除指定商品
cart.delGoods(goodsId);
// 更新 session 中的购物车对象
session.setAttribute("cart", cart);
return "yes"; // 返回成功标志
}
/**
*
*
* @return ("yes" )
*/
public String clearCart() {
// 获取 WebContext 上下文
WebContext ctx = WebContextFactory.get(); // 通过 DWR 获取 WebContext
HttpSession session = ctx.getSession(); // 获取当前会话对象
// 获取购物车对象
Cart cart = (Cart) session.getAttribute("cart");
// 清空购物车中的所有商品
cart.getItems().clear();
// 更新 session 中的购物车对象
session.setAttribute("cart", cart);
return "yes"; // 返回成功标志
}
}

@ -0,0 +1,344 @@
package com.itbaizhan.service;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import com.itbaizhan.dao.DB;
import com.itbaizhan.orm.Tcatelog;
import com.itbaizhan.orm.Tgoods;
import com.itbaizhan.orm.Torder;
import com.itbaizhan.orm.TorderItem;
import com.itbaizhan.orm.Txinyong;
/**
* liuService
*
*
*/
public class liuService {
/**
* ID
*
* @return List ID
*/
public static List catelogList() {
List catelogList = new ArrayList(); // 初始化菜品种类列表
String sql = "select * from t_catelog where del='no'"; // 查询未被删除的菜品种类
Object[] params = {}; // 设置查询参数为空
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行 SQL 查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
Tcatelog catelog = new Tcatelog(); // 创建 Tcatelog 对象
catelog.setId(rs.getString("id")); // 设置菜品类别 ID
catelog.setName(rs.getString("name")); // 设置菜品类别名称
catelogList.add(catelog); // 将菜品类别添加到列表
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return catelogList; // 返回菜品类别列表
}
/**
*
*
* @param id ID
* @return Tgoods
*/
public static Tgoods getGoods(String id) {
Tgoods goods = new Tgoods(); // 初始化商品对象
String sql = "select * from t_goods where id=?"; // 查询指定商品的 SQL 语句
Object[] params = { id }; // 设置查询参数为商品 ID
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
rs.next(); // 移动到第一行(只查询一条记录)
// 设置商品属性
goods.setId(rs.getString("id"));
goods.setCatelog_id(rs.getString("catelog_id"));
goods.setBianhao(rs.getString("bianhao"));
goods.setMingcheng(rs.getString("mingcheng"));
goods.setJieshao(rs.getString("jieshao"));
goods.setFujian(rs.getString("fujian"));
goods.setShichangjia(rs.getInt("shichangjia"));
goods.setTejia(rs.getInt("tejia"));
goods.setDel(rs.getString("del"));
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return goods; // 返回商品对象
}
/**
* ID 8
*
* @return
*/
public static List goodsNew() {
List goodsList = new ArrayList(); // 初始化商品列表
String sql = "select * from t_goods where del='no' order by id desc"; // 查询未删除的商品,按 ID 降序排列
Object[] params = {}; // 设置查询参数为空
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
Tgoods goods = new Tgoods(); // 创建 Tgoods 对象
// 设置商品属性
goods.setId(rs.getString("id"));
goods.setCatelog_id(rs.getString("catelog_id"));
goods.setBianhao(rs.getString("bianhao"));
goods.setMingcheng(rs.getString("mingcheng"));
goods.setJieshao(rs.getString("jieshao"));
goods.setFujian(rs.getString("fujian"));
goods.setShichangjia(rs.getInt("shichangjia"));
goods.setTejia(rs.getInt("tejia"));
goods.setDel(rs.getString("del"));
goodsList.add(goods); // 将商品添加到列表
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
// 限制返回最多 8 个商品
if (goodsList.size() > 8) {
goodsList = goodsList.subList(0, 8);
}
return goodsList; // 返回最新商品列表
}
/**
* ID
*
* @param catelog_id ID
* @return
*/
public static List goodsByCatelog(String catelog_id) {
List goodsList = new ArrayList(); // 初始化商品列表
String sql = "select * from t_goods where del='no' and catelog_id=? order by id desc"; // 根据类别 ID 查询商品
Object[] params = { catelog_id }; // 设置查询参数为菜品类别 ID
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
Tgoods goods = new Tgoods(); // 创建 Tgoods 对象
// 设置商品属性
goods.setId(rs.getString("id"));
goods.setCatelog_id(rs.getString("catelog_id"));
goods.setBianhao(rs.getString("bianhao"));
goods.setMingcheng(rs.getString("mingcheng"));
goods.setJieshao(rs.getString("jieshao"));
goods.setFujian(rs.getString("fujian"));
goods.setShichangjia(rs.getInt("shichangjia"));
goods.setTejia(rs.getInt("tejia"));
goods.setDel(rs.getString("del"));
goodsList.add(goods); // 将商品添加到列表
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return goodsList; // 返回商品列表
}
/**
*
*
* @param order
*/
public static void saveOrder(Torder order) {
String sql = "insert into t_order(id,bianhao,shijian,zhuangtai,huifu,songhuodizhi,fukuanfangshi,jine,user_id) values(?,?,?,?,?,?,?,?,?)";
Object[] params = { order.getId(), order.getBianhao(), order.getShijian(), order.getZhuangtai(),
order.getHuifu(), order.getSonghuodizhi(), order.getFukuanfangshi(), order.getJine(), order.getUser_id() };
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行插入操作
mydb.closed(); // 关闭数据库连接
}
/**
*
*
* @param id ID
* @param order_id ID
* @param goods_id ID
* @param goods_quantity
*/
public static void saveOrderItem(String id, String order_id, String goods_id, int goods_quantity) {
String sql = "insert into t_orderitem(id,order_id,goods_id,goods_quantity) values(?,?,?,?)";
Object[] params = { id, order_id, goods_id, goods_quantity };
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行插入操作
mydb.closed(); // 关闭数据库连接
}
/**
*
*
* @param goods_id ID
* @param goods_quantity
*/
public static void updateGoodsKucun(String goods_id, int goods_quantity) {
String sql = "update t_goods set kucun=kucun-? where id=?";
Object[] params = { goods_quantity, goods_id };
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行更新操作
mydb.closed(); // 关闭数据库连接
}
/**
*
*
* @param user_id ID
* @return
*/
public static List orderList(String user_id) {
List orderList = new ArrayList(); // 初始化订单列表
String sql = "select * from t_order where user_id=?"; // 查询该用户的所有订单
Object[] params = { user_id }; // 设置查询参数为用户 ID
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
Torder order = new Torder(); // 创建 Torder 对象
// 设置订单属性
order.setId(rs.getString("id"));
order.setBianhao(rs.getString("bianhao"));
order.setShijian(rs.getString("shijian"));
order.setZhuangtai(rs.getString("zhuangtai"));
order.setHuifu(rs.getString("huifu"));
order.setSonghuodizhi(rs.getString("songhuodizhi"));
order.setFukuanfangshi(rs.getString("fukuanfangshi"));
order.setJine(rs.getInt("jine"));
order.setUser_id(rs.getString("user_id"));
orderList.add(order); // 将订单添加到列表
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return orderList; // 返回订单列表
}
/**
*
*
* @param order_id ID
* @return
*/
public static List orderItemList(String order_id) {
List orderitemList = new ArrayList(); // 初始化订单商品列表
String sql = "select * from t_orderitem where order_id=?"; // 查询订单中包含的商品
Object[] params = { order_id }; // 设置查询参数为订单 ID
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
TorderItem orderItem = new TorderItem(); // 创建 TorderItem 对象
// 设置订单商品属性
orderItem.setId(rs.getString("id"));
orderItem.setGoods(getGoods(rs.getString("goods_id"))); // 获取商品信息
orderItem.setGoods_quantity(rs.getInt("goods_quantity")); // 设置商品数量
orderitemList.add(orderItem); // 将订单商品添加到列表
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return orderitemList; // 返回订单商品列表
}
/**
*
*
* @param loginname
* @return "yizhan" "meizhan"
*/
public static String panduan_zhanghao(String loginname) {
String s = "meizhan"; // 默认返回“没占用”
String sql = "select * from t_user where del='no' and loginname=?"; // 查询账号是否存在
Object[] params = { loginname.trim() }; // 设置查询参数为账号
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 如果查询到结果,表示账号已存在
s = "yizhan"; // 账号已占用
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return s; // 返回账号是否已占用
}
/**
*
*
* @param user_id ID
* @return
*/
public static List getxinyongList(String user_id) {
List xinyongList = new ArrayList(); // 初始化信用信息列表
String sql = "select * from t_xinyong where user_id=?"; // 查询该用户的信用信息
Object[] params = { user_id }; // 设置查询参数为用户 ID
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
Txinyong xinyong = new Txinyong(); // 创建 Txinyong 对象
// 设置信用信息属性
xinyong.setId(rs.getString("id"));
xinyong.setShuxing(rs.getString("shuxing"));
xinyong.setNeirong(rs.getString("neirong"));
xinyong.setShijian(rs.getString("shijian"));
xinyong.setUser_id(rs.getString("user_id"));
xinyongList.add(xinyong); // 将信用信息添加到列表
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return xinyongList; // 返回信用信息列表
}
}

@ -0,0 +1,166 @@
package com.itbaizhan.service;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.directwebremoting.WebContext;
import org.directwebremoting.WebContextFactory;
import com.itbaizhan.dao.DB;
import com.itbaizhan.orm.TAdmin;
import com.itbaizhan.orm.Tcatelog;
import com.itbaizhan.orm.Tuser;
import com.itbaizhan.util.Cart;
public class loginService {
/**
*
*
* session
*
* @param userName
* @param userPw
* @param userType 012
* @return "yes" "no"
*/
public String login(String userName, String userPw, int userType) {
String result = "no"; // 默认登录失败
if (userType == 0) { // 系统管理员登录
String sql = "select * from t_admin where userName=? and userPw=?";
Object[] params = { userName, userPw };
DB mydb = new DB();
mydb.doPstm(sql, params);
try {
ResultSet rs = mydb.getRs(); // 获取查询结果集
boolean mark = (rs == null || !rs.next() ? false : true); // 判断查询结果是否为空
if (!mark) {
result = "no"; // 登录失败
} else {
result = "yes"; // 登录成功
TAdmin admin = new TAdmin();
admin.setUserId(rs.getInt("userId"));
admin.setUserName(rs.getString("userName"));
admin.setUserPw(rs.getString("userPw"));
WebContext ctx = WebContextFactory.get(); // 获取 WebContext 对象
HttpSession session = ctx.getSession();
session.setAttribute("userType", 0); // 设置用户类型为管理员
session.setAttribute("admin", admin); // 将管理员信息存入 session
}
rs.close();
} catch (SQLException e) {
System.out.println("登录失败!");
e.printStackTrace();
} finally {
mydb.closed();
}
}
if (userType == 1) { // 会员登录
String sql = "select * from t_user where loginname=? and loginpw=? and del='no'";
Object[] params = { userName, userPw };
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行 SQL 查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
boolean mark = (rs == null || !rs.next() ? false : true); // 判断查询结果是否为空
if (!mark) {
result = "no"; // 登录失败
} else {
result = "yes"; // 登录成功
Tuser user = new Tuser();
user.setId(rs.getString("id"));
user.setLoginname(rs.getString("loginname"));
user.setLoginpw(rs.getString("loginpw"));
user.setName(rs.getString("name"));
user.setDel(rs.getString("del"));
WebContext ctx = WebContextFactory.get(); // 获取 WebContext 对象
HttpSession session = ctx.getSession();
session.setAttribute("userType", 1); // 设置用户类型为会员
session.setAttribute("user", user); // 将用户信息存入 session
// 创建一个空的购物车对象,存入 session
Cart cart = new Cart();
session.setAttribute("cart", cart);
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed();
}
if (userType == 2) {
// 用户类型为 2 的登录逻辑可以在这里添加(暂未实现)
}
return result; // 返回登录结果
}
/**
*
*
*
* @param userPwNew
* @return "yes"
*/
public String adminPwEdit(String userPwNew) {
System.out.println("DDDD");
try {
Thread.sleep(700); // 确保线程运行顺序
} catch (InterruptedException e) {
e.printStackTrace();
}
WebContext ctx = WebContextFactory.get(); // 获取 WebContext 对象
HttpSession session = ctx.getSession();
TAdmin admin = (TAdmin) session.getAttribute("admin"); // 获取当前登录的管理员对象
String sql = "update t_admin set userPw=? where userId=?";
Object[] params = { userPwNew, admin.getUserId() }; // 设置更新的参数
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行更新操作
return "yes"; // 返回修改成功的结果
}
/**
*
*
*
* @return
*/
public List catelogAll() {
try {
Thread.sleep(700); // 确保线程运行顺序
} catch (InterruptedException e) {
e.printStackTrace();
}
List catelogList = new ArrayList(); // 初始化菜品类别列表
String sql = "select * from t_catelog where del='no'"; // 查询未删除的菜品类别
Object[] params = {};
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
Tcatelog catelog = new Tcatelog();
catelog.setId(rs.getString("id")); // 设置菜品类别 ID
catelog.setName(rs.getString("name")); // 设置菜品类别名称
catelogList.add(catelog); // 将菜品类别添加到列表
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return catelogList; // 返回菜品类别列表
}
}

@ -1,157 +0,0 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type='text/javascript' src='<%=path %>/dwr/interface/cartService.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/engine.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/util.js'></script>
<script type="text/javascript">
function delGoodsFromCart(goodsId) //删除购物车里的货物
{
document.getElementById("indicator1").style.display="block";
cartService.delGoodsFromCart(goodsId,callback111);
}
function clearCart() //清空购物车
{
document.getElementById("indicator1").style.display="block";
cartService.clearCart(callback111);
}
function modiNum(goodsId,quantity) //改变购物车里物品的数量
{
var r1= /^[0-9]*[1-9][0-9]*$/  //正整数
var val=r1.test(quantity); //quantity为你要判断的字符 执行返回结果 true 或 false
if(val==false)
{
alert("数量必须是数字,请重新输入");
}
else //否则调用modiNum函数改变购物车中物品的数量
{
document.getElementById("indicator1").style.display="block";
cartService.modiNum(goodsId,quantity,callback111);
}
}
function callback111(data) //判断是否订单符合库存
{
document.getElementById("indicator1").style.display="none";
if(data=="no")
{
alert("库存不足");
}
if(data=="yes") //够库存,重新加载该页面
{
document.location.reload(true);
}
}
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!-- 头部 -->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
</div>
<!-- 头部 -->
<div id="page">
<div id="page-bgtop">
<!-- 右侧 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#">我的购物车</a></h2>
<div class="entry">
<table width="98%" border="0" cellpadding="2" cellspacing="1" align="center" style="margin-top:8px">
<tr align="center" bgcolor="#FAFAF1" height="22">
<td>商品名称</td>
<td>购买价格</td>
<td>购买数量</td>
<td>总金额</td>
<td>操作</td>
</tr>
<c:forEach items="${sessionScope.cart.items}" var="item">
<tr align='center' bgcolor="#FFFFFF" height="22">
<td bgcolor="#FFFFFF" align="center">${item.value.goods.mingcheng}</td>
<td bgcolor="#FFFFFF" align="center">¥:${item.value.goods.tejia}</td>
<td bgcolor="#FFFFFF" align="center"><input type="text" onChange="modiNum(${item.value.goods.id},this.value)" value="${item.value.goods_quantity}" size="4"/></td>
<!-- 改变数量 -->
<td bgcolor="#FFFFFF" align="center">${item.value.goods.tejia * item.value.goods_quantity}</td>
<!-- 总金额=特价*数量 -->
<td bgcolor="#FFFFFF" align="center">
<input type="button" value="删除" style="width: 50px;height: 20px;" onclick="delGoodsFromCart(${item.value.goods.id})">
</td>
</tr>
</c:forEach>
<tr>
<td colspan="5" class="Order_Total" align="right">
<br>
总金额:<span id="totalMoney">${sessionScope.cart.totalPrice}</span>
&nbsp;&nbsp;&nbsp;&nbsp;
<img id="indicator1" src="<%=path %>/images/loading.gif" style="display:none"/>
</td>
</tr>
</table>
<table>
<tr height="7"><td></td></tr>
<tr>
<td width="120"></td>
<td>
<input type="button" value="清空" style="width: 80px;height: 30px;" onclick="clearCart()">
</td>
<td>
<input type="button" value="继续" style="width: 80px;height: 30px;" onclick="javascript:window.location.href='<%=path %>/site/default.jsp'">
</td>
<td>
<input type="button" value="结账" style="width: 80px;height: 30px;" onclick="javascript:window.location.href='<%=path %>/site/order/orderQueren.jsp'">
</td>
</tr>
</table>
</div>
</div>
</div>
<!-- 右侧 -->
<!-- 左侧 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧 -->
<div style="clear: both;">&nbsp;</div>
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -1,23 +0,0 @@
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><!-- 返回该网页的根urlrequest.getScheme()返回协议的名称http。request.getServerName()获取服务器的名称localhostrequest.getServerPort()获取端口8080-->
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
<script type="text/javascript">
var url="<%=path %>/index?type=index"
window.location.href=url;//默认跳转的界面的地址
</script>
</body>
</html>

@ -1,93 +0,0 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!-- 头部 -->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
</div>
<!-- 头部 -->
<div id="page">
<div id="page-bgtop">
<!-- 右侧 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#">菜品信息</a></h2>
<div class="entry"> <!-- 设置菜品图片样式 -->
<TABLE class=main border=0 cellSpacing=2 cellPadding=2>
<TR>
<c:forEach items="${requestScope.goodsList}" var="goods" varStatus="sta">
<c:if test="${sta.index%4==0}"><!-- 每行放4张图片 -->
</tr><tr>
</c:if>
<TD>
<TABLE onmouseover="this.style.backgroundColor='#FF6600'" onmouseout="this.style.backgroundColor=''" border=0 cellSpacing=1 cellPadding=2 width=98 bgColor=#e1e1e1 align=center height=100>
<TR>
<TD bgColor=#ffffff align=left>
<P align="center">
<A href="<%=path %>/goods?type=goodsDetailQian&id=${goods.id }"><IMG border=0 align=absMiddle src="<%=path %>/${goods.fujian }" width=150 height=140></A>
</>
<center><A href="<%=path %>/goods?type=goodsDetailQian&id=${goods.id }"><FONT color=#ff0000></FONT>${goods.mingcheng }</A></center>
</P>
</TD>
</TR>
</TABLE>
</TD>
</c:forEach>
</TR>
</TABLE>
</div>
</div>
</div>
<!-- 右侧 -->
<!-- 左侧 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧 -->
<div style="clear: both;">&nbsp;</div> <!-- clear:both该属性的值指出了不允许有浮动元素 -->
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -1,110 +0,0 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
function buy1()
{
<c:if test="${sessionScope.userType !=1}">
alert("请先登录");
</c:if>
<c:if test="${sessionScope.userType==1}">
if(document.buy.quantity.value=="")
{
alert("请输入购买数量");
return false;
}
document.buy.submit();
</c:if>
}
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!--头部 -->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
</div>
<!-- 头部 -->
<div id="page">
<div id="page-bgtop">
<!-- 右侧 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#">菜品详细信息</a></h2>
<div class="entry">
<form action="<%=path %>/buy?type=addToCart" method="post" name="buy">
<table width="100%" border="0" cellpadding="9" cellspacing="9">
<tr>
<td align="left"><img width="220" height="180" src="<%=path %>/${requestScope.goods.fujian }" style="border:1px solid #ccc; padding:3px;"/></td>
</tr>
<tr>
<td align="left">商品编号:${requestScope.goods.bianhao }</td>
</tr>
<tr>
<td align="left">商品名称:${requestScope.goods.mingcheng }</td>
</tr>
<tr>
<td align="left">商品描述:<c:out value="${requestScope.goods.jieshao }" escapeXml="false"></c:out></td>
</tr>
<tr>
<td align="left">价格:${requestScope.goods.shichangjia }</td>
</tr>
<tr>
<td align="left">
数量:<input type="text" name="quantity" value="1" size="8" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"/>
<!--插入菜品的数量框onpropertychange当输入框属性变化时触发onchange1属性修改数据库菜品价格 下一句为按键之后触发将输入值为非数字的字符替换为空,粘贴之后触发将输入值为非数字的字符替换为空-->
<input type="hidden" name="goods_id" value="${requestScope.goods.id }"/>
<input type="button" value="购买" style="width: 80px;height: 30px;" onclick="buy1()">
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<!-- 右侧 -->
<!-- 左侧 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧 -->
<div style="clear: both;">&nbsp;</div>
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -1,93 +0,0 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!-- 头部 -->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
</div>
<!-- 头部 -->
<div id="page">
<div id="page-bgtop">
<!-- 右侧 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#">菜品信息</a></h2>
<div class="entry"> <!-- 设置菜品图片样式 -->
<TABLE class=main border=0 cellSpacing=2 cellPadding=2>
<TR>
<c:forEach items="${requestScope.goodsList}" var="goods" varStatus="sta">
<c:if test="${sta.index%4==0}"> <!-- 每行放4张图片 -->
</tr><tr>
</c:if>
<TD>
<TABLE onmouseover="this.style.backgroundColor='#FF6600'" onmouseout="this.style.backgroundColor=''" border=0 cellSpacing=1 cellPadding=2 width=98 bgColor=#e1e1e1 align=center height=100>
<TR>
<TD bgColor=#ffffff align=left>
<P align="center">
<A href="<%=path %>/goods?type=goodsDetailQian&id=${goods.id }"><IMG border=0 align=absMiddle src="<%=path %>/${goods.fujian }" width=150 height=140></A>
</>
<center><A href="<%=path %>/goods?type=goodsDetailQian&id=${goods.id }"><FONT color=#ff0000></FONT>${goods.mingcheng }</A></center>
</P>
</TD>
</TR>
</TABLE>
</TD>
</c:forEach>
</TR>
</TABLE>
</div>
</div>
</div>
<!-- 右侧 -->
<!-- 左侧 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧 -->
<div style="clear: both;">&nbsp;</div>
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -1,92 +0,0 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!-- 头部 -->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
</div>
<!-- 头部 -->
<div id="page">
<div id="page-bgtop">
<!-- 右侧 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#">菜品信息</a></h2>
<div class="entry">
<TABLE class=main border=0 cellSpacing=2 cellPadding=2>
<TR>
<c:forEach items="${requestScope.goodsList}" var="goods" varStatus="sta">
<c:if test="${sta.index%4==0}">
</tr><tr>
</c:if>
<TD>
<TABLE onmouseover="this.style.backgroundColor='#FF6600'" onmouseout="this.style.backgroundColor=''" border=0 cellSpacing=1 cellPadding=2 width=98 bgColor=#e1e1e1 align=center height=100>
<TR>
<TD bgColor=#ffffff align=left>
<P align="center">
<A href="<%=path %>/goods?type=goodsDetailQian&id=${goods.id }"><IMG border=0 align=absMiddle src="<%=path %>/${goods.fujian }" width=150 height=140></A>
</>
<center><A href="<%=path %>/goods?type=goodsDetailQian&id=${goods.id }"><FONT color=#ff0000></FONT>${goods.mingcheng }</A></center>
</P>
</TD>
</TR>
</TABLE>
</TD>
</c:forEach>
</TR>
</TABLE>
</div>
</div>
</div>
<!-- 右侧 -->
<!-- 左侧 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧 -->
<div style="clear: both;">&nbsp;</div>
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -1,90 +0,0 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!-- 头部 -->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
</div>
<!-- 头部 -->
<div id="page">
<div id="page-bgtop">
<!-- 右侧 -->
<div id="content">
<div class="post">
<!-- <h2 class="title"><a href="#">菜品信息</a></h2> -->
<div class="entry">
<form name="ff" method="post" action="<%=path %>/goods?type=goodsRes">
<table align="left" border="0" cellpadding="9" cellspacing="9">
<tr align='center'>
<td style="width: 60px;" align="left">
菜品名称:
</td>
<td align="left">
<input name="mingcheng" type="text" style="width: 200px;" />
</td>
</tr>
<tr align='center'>
<td style="width: 60px;" align="left"></td>
<td align="left">
<input type="submit" value="查询"/>&nbsp;
<input type="reset" value="重置"/>&nbsp;
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<!-- 右侧 -->
<!-- 左侧 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧 -->
<div style="clear: both;">&nbsp;</div>
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -1,81 +0,0 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type="text/javascript" src="<%=path %>/js/popup_shuaxin.js"></script>
<script type="text/javascript">
function userlogin() //会员登录
{
var url="<%=path %>/site/userlogin/userlogin.jsp";
var pop=new Popup({ contentType:1,isReloadOnClose:false,width:400,height:200}); //pop类型为1内嵌iframe关闭后不重新加载页面
pop.setContent("contentUrl",url);
pop.setContent("title","会员登录");
pop.build();
pop.show();
}
function mycart() //我的购物车
{
<c:if test="${sessionScope.userType !=1}"> //判断是否登录了
alert("请先登录");
</c:if>
<c:if test="${sessionScope.userType==1}">
var url="<%=path %>/site/cart/mycart.jsp";
window.open(url,"_self");
</c:if>
}
function myorder()
{
<c:if test="${sessionScope.userType !=1}"> //判断是否登录了
alert("请先登录");
</c:if>
<c:if test="${sessionScope.userType==1}">
var url="<%=path %>/buy?type=myorder";
window.open(url,"_self");
</c:if>
}
</script>
</head>
<body>
<div id="menu">
<ul>
<li><a href="<%=path %>/goods?type=goodsNew">菜品信息</a></li>
<li><a href="<%=path %>/site/userreg/userreg.jsp">注册会员</a></li>
<li><a href="<%=path %>/site/goods/goodsSea.jsp">菜品查询</a></li>
<li><a href="#" onclick="mycart()">我的购物车</a></li>
<li><a href="#" onclick="myorder()">我的订单</a></li>
<li><a href="<%=path %>/liuyan?type=liuyanAll">系统留言板</a></li>
</ul>
</div>
<div id="search">
<form method="post" action="" style="color: white;font-family: 微软雅黑">
<c:if test="${sessionScope.userType ==1 }">
欢迎您:${sessionScope.user.name }&nbsp;&nbsp; <!--取得用户名-->
<a href="<%=path %>/user?type=userLogout" style="color: white;font-family: 微软雅黑">安全退出</a> &nbsp;&nbsp;
</c:if>
<c:if test="${sessionScope.userType !=1 }"> <!-- 如果未登录显示会员登录按钮 -->
<a href="#" onclick="userlogin()" style="color: white;font-family: 微软雅黑">会员登陆</a>
</c:if>
</form>
</div>
</body>
</html>

@ -1,47 +0,0 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
<ul>
<!-- <li>
<h2>会员登录</h2>
<p>Mauris vitae nisl n ornare, orci in consectetuer hendrerit, volutpat.</p>
</li> -->
<li>
<h2>菜品类别</h2>
<ul>
<c:forEach items="${sessionScope.catelogList}" var="catelog">
<li><a href="<%=path %>/goods?type=goodsByCatelog&catelog_id=${catelog.id}">${catelog.name}</a></li>
</c:forEach>
</ul>
</li>
<li>
</li>
</ul>
</body>
</html>

@ -1,72 +0,0 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<!--调用一个外部的CSS样式文件,css的链接路径是path/css/qiantai.css,调用的样式为stylesheet输出媒介是屏幕-->
<script type="text/javascript">
var url="<%=path %>/goods?type=goodsNew"
window.location.href=url;//跳转到该页面,传入参数
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!-- 标题部分结束 -->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
<!-- 进入daohang.jsp导航页面设置如果缓存区满了就输出数据。-->
</div>
<div id="page">
<div id="page-bgtop">
<!-- 右侧css样式设置 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#">1111</a></h2>
<div class="entry">
<p>Sed lacus. Donec lectus. Nullam prum. Proin imperdiet est. Phasellus dapibus semper urna. Pellentesque ornare,</p>
<!-- 拉丁文排版测试 -->
</div>
</div>
</div>
<!-- 右侧css样式设置 -->
<!-- 左侧设置 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧设置 -->
<div style="clear: both;">&nbsp;</div><!-- clear:both该属性的值指出了不允许有浮动元素 -->
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -1,60 +0,0 @@
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!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>
<base target="_self"/>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
<meta http-equiv="description" content="This is my page" />
<link rel="stylesheet" type="text/css" href="<%=path %>/css/base.css" />
<script language="javascript">
function c()//判断是否输入留言
{
if(document.formAdd.neirong.value=="")
{
alert("请输入信息内容");
return false;
}
document.formAdd.submit();
}
</script>
</head>
<body leftmargin="2" topmargin="9" background='<%=path %>/img/allbg.gif'>
<form action="<%=path %>/liuyan?type=liuyanAdd" name="formAdd" method="post">
<table width="98%" align="center" border="0" cellpadding="4" cellspacing="1" bgcolor="#CBD8AC" style="margin-bottom:8px">
<tr bgcolor="#EEF4EA">
<td colspan="3" background="<%=path %>/img/wbg.gif" class='title'><span>&nbsp;</span></td>
</tr>
<tr align='center' bgcolor="#FFFFFF" height="22">
<td width="10%" bgcolor="#FFFFFF" align="right">
信息内容:
</td>
<td width="90%" bgcolor="#FFFFFF" align="left">
<input type="text" name="neirong" size="80"/>
</td>
</tr>
<tr align='center' bgcolor="#FFFFFF" height="22">
<td width="10%" bgcolor="#FFFFFF" align="right">
&nbsp;
</td>
<td width="90%" bgcolor="#FFFFFF" align="left">
<input type="button" value="提交" onclick="c()"/>&nbsp;
<input type="reset" value="重置"/>&nbsp;
</td>
</tr>
</table>
</form>
</body>
</html>

@ -1,108 +0,0 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<style rel="stylesheet" type="text/css">
.c1-bline{border-bottom:#999 1px dashed;border-top:1px;}
.f-right{float:right}
.f-left{float:left}
.clear{clear:both}
</style>
<script type="text/javascript">
function liuyanAdd()//添加留言,上面设置了向右浮动dashed虚线框上边框无浮动元素
{
<c:if test="${sessionScope.userType!=1}">//如果没有登录
alert("请先登录");
</c:if>
<c:if test="${sessionScope.userType==1}">//如果登录了,创建个窗口,重载当前页面
var strUrl = "<%=path %>/site/liuyan/liuyanAdd.jsp";
var ret = window.open(strUrl,"","dialogWidth:800px; dialogHeight:500px; dialogLeft: status:no; directories:yes;scrollbars:yes;Resizable=no;");
window.location.reload();
</c:if>
}
function liuyanDetail(id)//留言明细
{
var strUrl = "<%=path %>/liuyan?type=liuyanDetail&id="+id;
var ret = window.open(strUrl,"","dialogWidth:800px; dialogHeight:500px; dialogLeft: status:no; directories:yes;scrollbars:yes;Resizable=no;");
}
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!-- 头部-->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
</div>
<!-- 头部 -->
<div id="page">
<div id="page-bgtop">
<!-- 中间 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#">&nbsp;&nbsp;留言板模块 </a></h2>
<div class="entry">
<c:forEach items="${requestScope.liuyanList}" var="liuyan">
<div class="c1-bline" style="padding:7px 0px;">
<div class="f-left">
&nbsp;&nbsp;&nbsp;
<img src="<%=path %>/images/head-mark4.gif" align="middle" class="img-vm" border="0"/>
<a href="#" onclick="liuyanDetail(${liuyan.id })">${liuyan.neirong}</a>
</div>
<div class="f-right">${liuyan.liuyanshi}</div>
<div class="clear"></div>
</div>
</c:forEach>
<br/>
<center>
<a href="#" onclick="liuyanAdd()" style="color: red">我要留言</a>
</center>
</div>
</div>
</div>
<!-- 中间 -->
<!-- 左侧 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧 -->
<div style="clear: both;">&nbsp;</div>
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -1,66 +0,0 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!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="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
<meta http-equiv="description" content="This is my page" />
<link rel="stylesheet" type="text/css" href="<%=path %>/css/base.css" />
<script language="javascript">
</script>
</head>
<body leftmargin="2" topmargin="9" background='<%=path %>/img/allbg.gif'>
<form action="<%=path %>/gonggaoAdd.action" name="formAdd" method="post">
<table width="98%" align="center" border="0" cellpadding="4" cellspacing="1" bgcolor="#CBD8AC" style="margin-bottom:8px">
<tr bgcolor="#EEF4EA">
<td colspan="3" background="<%=path %>/img/wbg.gif" class='title'><span>&nbsp;</span></td>
</tr>
<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
<td width="25%" bgcolor="#FFFFFF" align="right">
信息内容:
</td>
<td width="75%" bgcolor="#FFFFFF" align="left">
${requestScope.liuyan.neirong }
</td>
</tr>
<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
<td width="25%" bgcolor="#FFFFFF" align="right">
发布时间:
</td>
<td width="75%" bgcolor="#FFFFFF" align="left">
${requestScope.liuyan.liuyanshi }
</td>
</tr>
<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
<td width="25%" bgcolor="#FFFFFF" align="right">
回复内容:
</td>
<td width="75%" bgcolor="#FFFFFF" align="left">
${requestScope.liuyan.huifu }
</td>
</tr>
<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
<td width="25%" bgcolor="#FFFFFF" align="right">
回复内容:
</td>
<td width="75%" bgcolor="#FFFFFF" align="left">
${requestScope.liuyan.huifushi }
</td>
</tr>
</table>
</form>
</body>
</html>

@ -1,113 +0,0 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
function orderDetail(order_id)//订单明细函数
{
var strUrl="<%=path %>/buy?type=orderDetail&order_id="+order_id;//传入参数
var ret = window.open(strUrl,"","dialogWidth:800px; dialogHeight:500px; dialogLeft: status:no; directories:yes;scrollbars:yes;Resizable=no;");
//点击订单明细弹出窗口宽800px高500px无状态栏目录栏可见有滚动栏不可改变大小
}
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!-- 我的订单页面的头部菜单栏daohang.jsp -->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
</div>
<!-- 我的订单页面的头部菜单栏daohang.jsp -->
<div id="page">
<div id="page-bgtop">
<!-- 右侧 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#">我的订单</a></h2>
<div class="entry">
<c:forEach items="${requestScope.orderList}" var="order">
<fieldset style="width:95%; margin-left:5px;"><legend class="fieldtitle"></legend>
<table class="bill" width="97%" cellpadding="4" cellspacing="4">
<tr>
<td>订单编号:${order.bianhao}</td>
</tr>
<tr>
<td>下单时间:${order.shijian}</td>
</tr>
<tr>
<td>
订单状态:
<c:if test="${order.zhuangtai=='no'}"> <!-- if的插入 -->
未受理
</c:if>
<c:if test="${order.zhuangtai=='yes'}">
已受理
</c:if>
</td>
</tr>
<tr>
<td>排队计时:${order.huifu}</td>
</tr>
<tr>
<td>送货地址:${order.songhuodizhi}</td>
</tr>
<tr>
<td>付款方式:${order.fukuanfangshi}</td>
</tr>
<tr>
<td>总金额:${order.jine}&nbsp;
<a href="#" onclick="orderDetail(${order.id})"/>订单明细</a>
</td>
</tr>
</table>
</fieldset>
<br/>
</c:forEach>
</div>
</div>
</div>
<!-- 右侧 -->
<!-- 左侧菜品类别 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧菜品类别 -->
<div style="clear: both;">&nbsp;</div>
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p> <a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -1,180 +0,0 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'orderDetail.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<style type="text/css">
a:link { color: #000000; text-decoration: none } //链接平常的状态,超链接无下划线
a:visited { color: #000000; text-decoration: none } //链接被访问之后,超链接无下划线
a:active { color: #000000; text-decoration: none } //鼠标放到连接上的时候,超链接无下划线
a:hover { color: #ff0000; text-decoration: none; position: relative; right: 0px; top: 1px } //连接被按下的时候,超链接无下划线,相对定位(随窗口大小变化而变化)
.C_Font{ font-weight:bold;}
.Red{ color:#FF0000; font-weight:bold;}
.Sell_Title{ text-align:center;background:url(<%=path %>/images/icon_sell.gif) top no-repeat left;
font-weight:bold; font-size:14px; color:#FFFFFF; height:30px;}
.UserName{ padding:4px 0;}
.UserName input{ width:100px; border:1px solid #666;}
.UserRegster{ padding:5px 8px 5px 0;}
.UserRegster a,.UserRegster a:link,.UserRegster a:visited{ color:#f50;}
.UserRegster input{ background:url(<%=path %>/images/button.gif) no-repeat; width:73px; height:23px; border:0px; cursor:hand;}
.LoginTitle{text-align:center;background:url(<%=path %>/images/icon_login.gif) top no-repeat left;font-weight:bold; font-size:14px; color:#FFFFFF; height:30px;}
.Logo{ text-align:center; vertical-align:top; margin:8px 0;}
.Item01Menu{ text-align:right; vertical-align:top;}
.Item01Menu a{ padding:2px 10px; background:url(<%=path %>/images/dot_main01.gif) no-repeat left;}
.C_Item_Title{ background:url(<%=path %>/images/icon05.gif) no-repeat center;font-weight:bold; text-align:center; color:#fff; height:34px;}
.C_Item_Title a,.C_Item_Title a:link,.C_Item_Title a:visited{font-weight:bold; text-align:center; color:#fff;}
.C_login_Title{ background:url(<%=path %>/images/heng.gif) no-repeat center;font-weight:bold;font-size:12px; text-align:center; color:#fff; height:34px; padding-top:10px;}
.C_Sell_Title{ background:url(<%=path %>/images/icon03.gif) no-repeat center;font-weight:bold; text-align:center; color:#fff; height:34px; padding-top:10px;}
.C_DC_Title{ background:url(<%=path %>/images/DC.gif) no-repeat center;font-weight:bold; text-align:center; color:#fff; height:34px; padding-top:10px;}
.C_Sort_Title{ background:url(<%=path %>/images/heng.gif) no-repeat center;font-weight:bold;font-size:12px; text-align:center; color:#fff; height:34px; padding-top:10px;}
.C_Sort_Title a,.C_Sort_Title a:link,.C_Sort_Title a:visited{ color:#fff;}
.C_Search_Title{ background:url(<%=path %>/images/Recomm_05.gif) no-repeat center;font-weight:bold; text-align:center; color:#fff; height:34px; padding-top:10px;}
.C_Help_Title{ padding:4px 0;}
.C_Help_Title a{ background:url(<%=path %>/images/icon_sell.gif) no-repeat center;font-weight:bold; color:#fff; height:24px; padding-left:15px; width:175px; padding-top:5px;}
.C_Help_Title a,.C_Help_Title a:link,.C_Help_Title a:visited{ color:#fff;}
.C_Goods_Title{ border:1px solid #ccc; background:url(<%=path %>/images/Bule_46.gif) repeat-x; margin-bottom:5px; height:32px;}
.C_Goods_Border{ border-top:4px solid #4380CC; padding-top:10px;}
.C_Item_bg{ background:url(<%=path %>/images/Bule_56.gif) repeat-y; padding:3px 8px;}
.C_pages{ padding:5px 10px; text-align:center;}
.C_Input{ background:url(<%=path %>/images/button2.gif) no-repeat; width:73px; height:23px; border:0px; cursor:hand; color:#333;}
.input{ color:#f50;height:18px; }
.C_Input02{background:url(<%=path %>/images/button.gif) no-repeat; width:73px; height:23px; border:0px; cursor:hand; color:#333;}
.C_Input03{background:url(<%=path %>/images/btn_2.png) no-repeat; width:69px; height:28px; border:0px; cursor:hand; color:#fff;}
.Register{background:url(<%=path %>/images/btn_1.png) no-repeat; width:105px; height:28px; border:0px; cursor:hand; text-align:center; padding-top:6px;}
//no-repeat不平铺
.Order_Table{ margin:15px 0;}
.Order_Table td{ font-size:14px;}
.Order_Font{ color:#FF0000; font-weight:bold;}
.Order_Title{ font-size:14px; font-weight:bold; padding:4px 5px;}
.Order_Total{ font-weight:bold; padding:5px 10px 0 10px; color:#FF0000; text-align:center; font-size:14px;}
.Car_Leftbg{ background:url(<%=path %>/images/Car_05.gif) repeat-y left; width:8px;}
.Car_Rightbg{ background:url(<%=path %>/images/Car_13.gif) repeat-y right; width:8px;}
.C_Carbg_Default{ background:url(<%=path %>/images/Car_21.gif) no-repeat center;font-size:12px; text-align:center; width:150px;}
.C_Carbg_Current{ background:url(<%=path %>/images/Car_18.gif) no-repeat center;font-size:12px; text-align:center; color:#fff; width:150px;}
.Onlinpay{
}
.Onlinpay input{ background:url(<%=path %>/images/Car_icon_07.gif) no-repeat center; width:115px; height:30px; border:0px; cursor:hand; padding-bottom:8px; padding-right:8px;}
.textBox{
border-bottom:1px;
border-left:1px;
border-right:1px;
border-top:1px;
border-color:#666666;
border-style:solid;
}
.itemTitle {
font-family: "黑体", "Arial Black";
font-size: 16px;
line-height: 40px;
font-weight: 200;
color: #000000;
text-decoration: none;
letter-spacing: 5px;
} //字母间距5px
.blueText {
font-family: "宋体", System;
font-size: 12px;
line-height: 20px;
color: #0033CC;
text-decoration: none;
}
.redText {
font-family: "宋体", System;
font-size: 12px;
line-height: 20px;
color: #FF0000;
text-decoration: none;
}
.text {
font-family: "宋体", System;
font-size: 12px;
line-height: 20px;
color: #000000;
text-decoration: none;
}
.body {
margin-left: 0px;
margin-top: 2px;
margin-right: 0px;
margin-bottom: 2px;
background-image: url(<%=path %>/images/backGroup.gif);
}
.header_menu{background:url(<%=path %>/images/header_menu_02.gif) repeat-x;}
.whiteTitle{
font-family: "宋体", System;
font-size: 13px;
line-height: 20px;
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
.whiteText {
font-family: "宋体", System;
font-size: 12px;
line-height: 20px;
color: #FFFFFF;
text-decoration: none;
}
.blackTitle {
font-family: "宋体", System;
font-size: 12px;
font-weight: bold;
line-height: 20px;
color: #000000;
text-decoration: none;
}
</style>
</head>
<body class="body" leftmargin="0" rightmargin="0">
<table cellspacing="1" cellpadding="0" width="100%" border="0" bgcolor="#F7F3F7">
<tr height="26">
<td class="blackTitle" align="center">商品名称</td>
<td class="blackTitle" align="center">购买数量</td>
<td class="blackTitle" align="center">购买价格</td>
</tr>
<c:forEach items="${requestScope.orderItemList}" var="orderItem">
<tr class="text" align="center" bgcolor="#FFFFFF">
<td>${orderItem.goods.mingcheng}</td>
<td>${orderItem.goods_quantity}</td>
<td>${orderItem.goods.tejia}</td>
</tr>
</c:forEach>
</table>
</body>
</html>

@ -1,123 +0,0 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <!-- 订单填写界面 -->
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
function back1() //返回之前的页面
{
window.history.go(-1);
}
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!-- 头部各种功能 -->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
</div>
<!-- 头部各种功能 -->
<div id="page">
<div id="page-bgtop">
<!--右侧 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#">填写订单</a></h2>
<div class="entry">
<form action="<%=path %>/buy?type=orderSubmit" name="f" method="post">
<table width="98%" align="center" border="0" cellpadding="9" cellspacing="9">
<tr align='center'>
<td width="20%" bgcolor="#FFFFFF" align="left">
收货人帐号:
</td>
<td width="80%" bgcolor="#FFFFFF" align="left">
<input type="text" readonly="readonly" value="${sessionScope.user.loginname}"/>
</td>
</tr>
<tr align='center'>
<td width="20%" bgcolor="#FFFFFF" align="left">
收货人姓名:
</td>
<td width="80%" bgcolor="#FFFFFF" align="left">
<input type="text" readonly="readonly" value="${sessionScope.user.name}"/>
</td>
</tr>
<tr align='center'>
<td width="20%" bgcolor="#FFFFFF" align="left">
送货地址:
</td>
<td width="80%" bgcolor="#FFFFFF" align="left">
<input type="text" name="songhuodizhi"/>
</td>
</tr>
<tr align='center'>
<td width="20%" bgcolor="#FFFFFF" align="left">
付款方式:
</td>
<td width="80%" bgcolor="#FFFFFF" align="left">
<select name="fukuanfangshi" style="width:155px;">
<option value="货到付款">货到付款</option>
</select> <!-- 下拉菜单 -->
</td>
</tr>
</table>
<table>
<tr height="7"><td></td></tr>
<tr>
<td width="120"></td>
<td>
<input type="button" value="返回" style="width: 80px;height: 30px;" onclick="back1()">
</td>
<td>
<input type="button" value="提交订单" style="width: 80px;height: 30px;" onclick="javascript:document.f.submit();">
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<!-- 右侧 -->
<!-- 左侧菜品类别 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧菜品类别 -->
<div style="clear: both;">&nbsp;</div>
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -1,94 +0,0 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
function back1()//返回之前的界面
{
window.history.go(-1);
}
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!-- 头部各种功能 -->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
</div>
<!-- 头部各种功能 -->
<div id="page">
<div id="page-bgtop">
<!-- 右侧 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#"></a></h2>
<div class="entry">
<table width="99%" border="0" cellpadding="5" cellspacing="5" bgcolor="#FFFFFF" align="center" style="margin-top:8px">
<tr>
<td align="left" style="color: red">恭喜您,订单提交成功!</td>
</tr>
<tr>
<td style="font-size: 15px;">订单编号:${requestScope.order.bianhao }</td>
</tr>
<tr>
<td style="font-size: 15px;">总金额:${requestScope.order.jine }</td>
</tr>
<tr>
<td style="font-size: 15px;">下单日期:${requestScope.order.shijian }</td>
</tr>
<tr>
<td style="font-size: 15px;">送货地址:${requestScope.order.songhuodizhi }</td>
</tr>
<tr>
<td style="font-size: 15px;">付款方式:${requestScope.order.fukuanfangshi }</td>
</tr>
</table>
</div>
</div>
</div>
<!-- 右侧 -->
<!-- 左侧菜品类别 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧菜品类别 -->
<div style="clear: both;">&nbsp;</div> <!--clear:both该属性的值指出了不允许有浮动元素 -->
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -1,84 +0,0 @@
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type='text/javascript' src='<%=path %>/dwr/interface/loginService.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/engine.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/util.js'></script>
<script type="text/javascript">
function login()//会员登录信息完整的判断
{
if(document.userLogin.loginname.value=="")
{
alert("请输入账号");
return;
}
if(document.userLogin.loginpw.value=="")
{
alert("请输入密码");
return;
}
document.getElementById("indicator").style.display="block";//设置成块级元素,带自动换行
loginService.login(document.userLogin.loginname.value,document.userLogin.loginpw.value,1,callback);//判断账号密码是否正确
}
function callback(data)
{
document.getElementById("indicator").style.display="none";
if(data=="no")//账号密码错误返回fail.jsp页面
{
var url="<%=path %>/common/fail.jsp";
window.location.href=url;
}
if(data!="no")//返回的data就是用户的id当账号密码正确时
{
var url="<%=path %>/common/succ.jsp";
window.location.href=url;
}
}
</script>
</head>
<body>
<form name="userLogin" method="POST" action="">
<table cellspacing="0" cellpadding="0" width="98%" align="center" border="0">
<tr>
<td align="center" colspan="2" height="10"></td>
</tr>
<tr>
<td align="right" width="31%" height="30" style="font-size: 11px;">账号:</td>
<td align="left" width="69%"><input type="text" name="loginname" style="width: 100px;"/></td>
</tr>
<tr>
<td align="right" height="30" style="font-size: 11px;">密码:</td>
<td align="left"><input type="password" name="loginpw" style="width: 100px;"/></td>
</tr>
<tr>
<td align="center" colspan="2" height="5"></td>
</tr>
<tr>
<td align="right" height="30" style="font-size: 11px;">&nbsp;</td>
<td align="left">
<input type="button" value="登 录" onclick="login()" style="border:#ccc 1px solid; background-color:#FFFFFF; font-size:12px; padding-top:3px;" />
&nbsp;
<input type="reset" value="重 置" style="border:#ccc 1px solid; background-color:#FFFFFF; font-size:12px; padding-top:3px;" />
<img id="indicator" src="<%=path %>/images/loading.gif" style="display:none"/> <!-- idindicator插入载入动画 -->
</td>
</tr>
</table>
</form>
</body>
</html>

@ -1,122 +0,0 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><!-- 会员注册页面 -->
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
function check1()//会员注册界面信息完整判断
{
if(document.form1.loginname.value=="")
{
alert("请输入账号");
return false;
}
if(document.form1.loginpw.value=="")
{
alert("请输入密码");
return false;
}
document.form1.submit();
}
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
<!-- 进入daohang.jsp导航页面设置如果缓存区满了就输出数据。-->
</div>
<!--标题头部部分-->
<div id="page">
<div id="page-bgtop">
<!-- 中间 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#">&nbsp;&nbsp;会员注册 </a></h2>
<div class="entry">
<form action="<%=path %>/user?type=userReg" name="form1" method="post">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="20%" height="30" align="right" bgcolor="#F9F9F9" style="font-size: 11px;">
账号:
</td>
<td width="80%" bgcolor="#FFFFFF">
&nbsp;
<input type="text" name="loginname" style="width: 200px;"/>
</td>
</tr>
<tr>
<td height="30" align="right" bgcolor="#F9F9F9" style="font-size: 11px;">
密码:
</td>
<td bgcolor="#FFFFFF">
&nbsp;
<input type="password" name="loginpw" style="width: 200px;"/>
</td>
</tr>
<tr>
<td height="30" align="right" bgcolor="#F9F9F9" style="font-size: 11px;">
姓名:
</td>
<td bgcolor="#FFFFFF">
&nbsp;
<input type="text" name="name" style="width: 200px;"/>
</td>
</tr>
<tr>
<td height="30" align="right" bgcolor="#F9F9F9">
&nbsp;
</td>
<td bgcolor="#FFFFFF">
&nbsp;
<input type="button" value="注册" onclick="check1();"/>
<input type="reset" value="重置"/>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<!-- 中间 -->
<!-- 左侧 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include><!--进入left.jsp左侧菜品类别页面设置如果缓存区满了就输出数据。-->
</div>
<!-- 左侧 -->
<div style="clear: both;">&nbsp;</div> <!--clear:both该属性的值指出了不允许有浮动元素 -->
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -1,49 +0,0 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.jspsmart.upload.*" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><!--功能已删除-->
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
<%
try
{
String fujianPath=request.getParameter("fujianPath");//获得图片路径
String fujianYuashiMing=request.getParameter("fujianYuashiMing");//获得图片的原始名
fujianYuashiMing=java.net.URLDecoder.decode(fujianYuashiMing,"UTF-8");//图片原始名的编码方式
System.out.println(fujianYuashiMing+fujianPath);//输出图片的原始名和路径
SmartUpload su = new SmartUpload(); // 新建一个SmartUpload对象
su.initialize(pageContext); // 初始化
su.setContentDisposition(null);
// 设定contentDisposition为null以禁止浏览器自动打开文件
//保证点击链接后是下载文件。若不设定,则下载的文件扩展名为
//doc时浏览器将自动用word打开它。扩展名为pdf时将用acrobat打开
su.downloadFile(fujianPath, null, new String(fujianYuashiMing.getBytes(), "ISO8859-1")); // 下载中文文件
out.clear();
out=pageContext.pushBody();
}
catch(Exception e)
{%>
<script type="text/javascript">
alert("文件不存在。请联系管理人员");
window.history.back();
</script>
<%}
%>
</body>
</html>

@ -0,0 +1,95 @@
package com.itbaizhan.util;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import com.itbaizhan.orm.Tgoods;
import com.itbaizhan.orm.TorderItem;
public class Cart {
// 购物车属性
// 使用一个 Map 存储购物项Map 的 key 是商品的 idvalue 是购物项 TorderItem
protected Map<String, TorderItem> items;
/**
*
* items null HashMap
*/
public Cart() {
if (items == null) {
items = new HashMap<String, TorderItem>(); // 初始化购物车,使用 HashMap 存储购物项
}
}
/**
*
*
*
* @param goodsId ID
* @param orderItem
*/
public void addGoods(String goodsId, TorderItem orderItem) {
// 判断购物车中是否已经存在该商品
if (items.containsKey(goodsId)) { // 如果购物车中已存在该商品
// 获取原有的购物项,更新商品的数量
TorderItem _orderItem = items.get(goodsId); // 获取购物车中原有的购物项
_orderItem.setGoods_quantity(_orderItem.getGoods_quantity() + orderItem.getGoods_quantity()); // 更新数量
items.put(goodsId, _orderItem); // 更新购物车中的该商品项
} else { // 如果购物车中没有该商品
items.put(goodsId, orderItem); // 将新的购物项添加到购物车
}
}
/**
*
* ID
*
* @param goodsId ID
*/
public void delGoods(String goodsId) {
items.remove(goodsId); // 从购物车中删除指定商品
}
/**
*
*
* @param goodsId ID
* @param quantity
*/
public void updateCart(String goodsId, int quantity) {
// 获取购物车中的购物项,并更新数量
TorderItem orderItem = items.get(goodsId);
orderItem.setGoods_quantity(quantity); // 更新数量
items.put(goodsId, orderItem); // 更新购物车中的该商品项
}
/**
*
*
*
* @return
*/
public int getTotalPrice() {
int totalPrice = 0; // 初始化总价为 0
// 遍历购物车中的所有商品
for (Iterator it = items.values().iterator(); it.hasNext();) {
TorderItem orderItem = (TorderItem) it.next(); // 获取当前购物项
Tgoods goods = orderItem.getGoods(); // 获取商品信息
int quantity = orderItem.getGoods_quantity(); // 获取商品数量
totalPrice += goods.getTejia() * quantity; // 计算该商品的总价并累加到总价
}
return totalPrice; // 返回购物车中商品的总价
}
/**
*
* Map key IDvalue
*
* @return
*/
public Map<String, TorderItem> getItems() {
return items; // 返回购物车中的所有商品
}
}

@ -0,0 +1,78 @@
package com.itbaizhan.util;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class EncodingFilter implements Filter {
// 用于存储编码格式
protected String encoding = null;
// 用于存储 Filter 的配置信息
protected FilterConfig filterConfig = null;
/**
*
*/
public void destroy() {
this.encoding = null; // 清空编码设置
this.filterConfig = null; // 清空过滤器配置
}
/**
*
*
*
* @param request 访
* @param response
* @param chain FilterChain Servlet
* @throws IOException IO
* @throws ServletException Servlet
*/
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
// 获取请求的编码格式
String encoding = selectEncoding(request);
// 如果编码格式不为空,则设置请求和响应的编码格式
if (encoding != null) {
request.setCharacterEncoding(encoding); // 设置请求的编码
response.setCharacterEncoding(encoding); // 设置响应的编码
}
// 将请求和响应传递给下一个过滤器或目标资源
chain.doFilter(request, response);
}
/**
*
* web.xml
*
* @param filterConfig
* @throws ServletException
*/
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
// 获取 web.xml 中配置的编码格式参数
this.encoding = filterConfig.getInitParameter("encoding");
}
/**
*
*
*
* @param request
* @return
*/
protected String selectEncoding(ServletRequest request) {
// 返回初始化时配置的编码格式
return (this.encoding);
}
}
Loading…
Cancel
Save