首页 前端知识 基于javaweb mysql的ssm电影售票管理系统(java ssm jsp jquery ajax mysql)

基于javaweb mysql的ssm电影售票管理系统(java ssm jsp jquery ajax mysql)

2024-06-24 23:06:47 前端知识 前端哥 754 642 我要收藏

基于javaweb+mysql的ssm电影售票管理系统(java+ssm+jsp+jquery+ajax+mysql)

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

基于javaweb的SSM电影售票管理系统(java+ssm+jsp+jquery+ajax+mysql)

项目介绍

管理员角色包含以下功能: 管理员登陆,管理员用户管理,新闻公告增删改查,电影类型增删改查,影院信息增删改查,电影信息增删改查,订单查询,电影评价管理等功能。 用户角色包含以下功能: 用户首页,用户登录,查看电影详情,加入购物车,下单电影票,查看我的订单,用户中心,评价电影等功能。 这个系统除了不提供在线选座,其他真的一个很完美的电影买票系统

环境需要

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

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+jQuery+Ajax

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中springmvc-servlet.xml配置文件中的数据库配置改为自己的配置; 4. 运行项目, 前台运行地址:输入localhost:8080/ssm_zxdydp/index/index.action 登录 用户账号/密码: ls/lisi 后台运行地址:localhost:8080/ssm_zxdydp/admin/index.jsp 管理员账号/密码:admin/admin
for (String ordersid : ids) {
this.ordersService.deleteOrders(ordersid);
}
return "redirect:/orders/getAllOrders.action";
}

// 更新数据
@RequestMapping("updateOrders.action")
public String updateOrders(Orders orders) {
this.ordersService.updateOrders(orders);
return "redirect:/orders/getAllOrders.action";
}
// 显示全部数据
@RequestMapping("getAllOrders.action")
public String getAllOrders(String number) {
List<Orders> ordersList = this.ordersService.getAllOrders();
PageHelper.getPage(ordersList, "orders", null, null, 10, number, this.getRequest(), null);
return "admin/listorders";
}

// 按条件查询数据 (模糊查询)
@RequestMapping("queryOrdersByCond.action")
public String queryOrdersByCond(String cond, String name, String number) {
Orders orders = new Orders();
if(cond != null){
if ("ordercode".equals(cond)) {
orders.setOrdercode(name);
}
if ("usersid".equals(cond)) {
orders.setUsersid(name);
}
if ("total".equals(cond)) {
orders.setTotal(name);
}
if ("status".equals(cond)) {
orders.setStatus(name);
}
if ("addtime".equals(cond)) {
orders.setAddtime(name);
}
}

List<String> nameList = new ArrayList<String>();
List<String> valueList = new ArrayList<String>();
nameList.add(cond);
valueList.add(name);
PageHelper.getPage(this.ordersService.getOrdersByLike(orders), "orders", nameList, valueList, 10, number, this.getRequest(), "query");
name = null;
cond = null;
		} else {
			buffer.append("<a href=\"index/recommend.action?number=" + (Integer.parseInt(number) + 1) + "\">下一页</a>");
		}
		buffer.append("&nbsp;&nbsp;");
		if (maxPage <= (Integer.parseInt(number) + 1)) {
			buffer.append("尾页");
		} else {
			buffer.append("<a href=\"index/recommend.action?number=" + (maxPage - 1) + "\">尾页</a>");
		}
		html = buffer.toString();
		this.getRequest().setAttribute("html", html);
		this.getRequest().setAttribute("flimList", flimList);
		return "users/list";
	}

	// 全部产品
	@RequestMapping("all.action")
	public String all(String number) {
		this.front();
		List<Film> flimList = new ArrayList<Film>();
		List<Film> tempList = this.filmService.getAllFilm();
		int pageNumber = tempList.size();
		int maxPage = pageNumber;
		if (maxPage % 12 == 0) {
			maxPage = maxPage / 12;
		} else {
			maxPage = maxPage / 12 + 1;
		}
		if (number == null) {
			number = "0";
		}
		int start = Integer.parseInt(number) * 12;
		int over = (Integer.parseInt(number) + 1) * 12;
		int count = pageNumber - over;
		if (count <= 0) {
			over = pageNumber;
		}
		for (int i = start; i < over; i++) {
			Film x = tempList.get(i);
			flimList.add(x);
		for (int i = start; i < over; i++) {
			Film x = tempList.get(i);
			flimList.add(x);
		}
		String html = "";
		StringBuffer buffer = new StringBuffer();
		buffer.append("&nbsp;&nbsp;共为");
		buffer.append(maxPage);
		buffer.append("页&nbsp; 共有");
		buffer.append(pageNumber);
		buffer.append("条&nbsp; 当前为第");
		buffer.append((Integer.parseInt(number) + 1));
		buffer.append("页 &nbsp;");
		if ((Integer.parseInt(number) + 1) == 1) {
			buffer.append("首页");
		} else {
			buffer.append("<a href=\"index/recommend.action?number=0\">首页</a>");
		}
		buffer.append("&nbsp;&nbsp;");
		if ((Integer.parseInt(number) + 1) == 1) {
			buffer.append("上一页");
		} else {
			buffer.append("<a href=\"index/recommend.action?number=" + (Integer.parseInt(number) - 1) + "\">上一页</a>");
		}
		buffer.append("&nbsp;&nbsp;");
		if (maxPage <= (Integer.parseInt(number) + 1)) {
			buffer.append("下一页");
		} else {
			buffer.append("<a href=\"index/recommend.action?number=" + (Integer.parseInt(number) + 1) + "\">下一页</a>");
		}
		buffer.append("&nbsp;&nbsp;");
		if (maxPage <= (Integer.parseInt(number) + 1)) {
			buffer.append("尾页");
		} else {
			buffer.append("<a href=\"index/recommend.action?number=" + (maxPage - 1) + "\">尾页</a>");
		}
		html = buffer.toString();
		this.getRequest().setAttribute("html", html);
		this.getRequest().setAttribute("flimList", flimList);
		return "users/list";
	}

	// 全部产品
	@RequestMapping("all.action")
	public String all(String number) {
		this.front();
		List<Film> flimList = new ArrayList<Film>();
		List<Film> tempList = this.filmService.getAllFilm();
		int pageNumber = tempList.size();
		int maxPage = pageNumber;
		} else {
			this.getRequest().setAttribute("message", "旧密码错误");
		}
		return "admin/editpwd";
	}

	// 管理员退出登录
	@RequestMapping("exit.action")
	public String exit() {
		this.getSession().removeAttribute("adminid");
		this.getSession().removeAttribute("adminname");
		this.getSession().removeAttribute("realname");
		return "admin/index";
	}

	// 准备添加数据
	@RequestMapping("createAdmin.action")
	public String createAdmin() {
		return "admin/addadmin";
	}

	// 添加数据
	@RequestMapping("addAdmin.action")
	public String addAdmin(Admin admin) {
		admin.setAddtime(VeDate.getStringDateShort());
		this.adminService.insertAdmin(admin);
		return "redirect:/admin/createAdmin.action";
	}

	// 通过主键删除数据
	@RequestMapping("deleteAdmin.action")
	public String deleteAdmin(String id) {
		this.adminService.deleteAdmin(id);
		return "redirect:/admin/getAllAdmin.action";
	}

	// 批量删除数据
	@RequestMapping("deleteAdminByIds.action")
	public String deleteAdminByIds() {
		String[] ids = this.getRequest().getParameterValues("adminid");
		for (String adminid : ids) {
			this.adminService.deleteAdmin(adminid);
		}
		return "redirect:/admin/getAllAdmin.action";
	}

		cond = null;
		return "admin/querycity";
	}

	// 按主键查询数据
	@RequestMapping("getCityById.action")
	public String getCityById(String id) {
		City city = this.cityService.getCityById(id);
		this.getRequest().setAttribute("city", city);
		return "admin/editcity";
	}

	public CityService getCityService() {
		return cityService;
	}

	public void setCityService(CityService cityService) {
		this.cityService = cityService;
	}

}

public class PageHelper {

	public static void getPage(List<?> list, String name, List<String> nameList, List<String> valueList, int pageSize, String number,
			HttpServletRequest request, String method) {
		StringBuffer buffer = new StringBuffer();
		String name2 = name.substring(0, 1).toUpperCase() + name.substring(1);
		String path = "";
		String action = "getAll" + name2 + ".action";
		if (method != null) {
			action = "query" + name2 + "ByCond.action";
		}

		List<Object> objList = new ArrayList<Object>();
		if (nameList != null && valueList != null) {
			for (int i = 0; i < nameList.size(); i++) {
				path += "&" + nameList.get(i) + "=" + valueList.get(i);
			}
		}
		int pageNumber = list.size();
		int maxPage = pageNumber;
		if (maxPage % 10 == 0) {
			maxPage = maxPage / 10;
		} else {
			maxPage = maxPage / 10 + 1;
		}
		if (number == null) {
@Autowired
@Resource
private TopicService topicService;
@Autowired
@Resource
private UsersService usersService;
@Autowired
@Resource
private FilmService filmService;

// 准备添加数据
@RequestMapping("createTopic.action")
public String createTopic() {
List<Users> usersList = this.usersService.getAllUsers();
this.getRequest().setAttribute("usersList", usersList);
List<Film> filmList = this.filmService.getAllFilm();
this.getRequest().setAttribute("filmList", filmList);
return "admin/addtopic";
}
// 添加数据
@RequestMapping("addTopic.action")
public String addTopic(Topic topic) {
this.topicService.insertTopic(topic);
return "redirect:/topic/createTopic.action";
}

// 通过主键删除数据
@RequestMapping("deleteTopic.action")
public String deleteTopic(String id) {
this.topicService.deleteTopic(id);
return "redirect:/topic/getAllTopic.action";
}

// 批量删除数据
@RequestMapping("deleteTopicByIds.action")
public String deleteTopicByIds() {
String[] ids = this.getRequest().getParameterValues("topicid");
for (String topicid : ids) {
this.topicService.deleteTopic(topicid);
}
return "redirect:/topic/getAllTopic.action";
}

// 更新数据
@RequestMapping("updateTopic.action")
public String updateTopic(Topic topic) {
this.topicService.updateTopic(topic);
return "redirect:/topic/getAllTopic.action";
}
// 显示全部数据
			return "redirect:/index/preLogin.action";
		} else {
			Users users = usersList.get(0);
			if (password.equals(users.getPassword())) {
				this.getSession().setAttribute("userid", users.getUsersid());
				this.getSession().setAttribute("username", users.getUsername());
				this.getSession().setAttribute("users", users);
				return "redirect:/index/index.action";
			} else {
				this.getSession().setAttribute("message", "密码错误");
				return "redirect:/index/preLogin.action";
			}
		}
	}

	// 准备注册
	@RequestMapping("preReg.action")
	public String preReg() {
		this.front();
		return "users/register";
	}

	// 用户注册
	@RequestMapping("register.action")
	public String register(Users users) {
		this.front();
		Users u = new Users();
		u.setUsername(users.getUsername());
		List<Users> usersList = this.usersService.getUsersByCond(u);
		if (usersList.size() == 0) {
			users.setRegdate(VeDate.getStringDateShort());
			this.usersService.insertUsers(users);
		} else {
			this.getSession().setAttribute("message", "用户名已存在");
			return "redirect:/index/preReg.action";
		}

		return "redirect:/index/preLogin.action";
	}

	// 退出登录
	@RequestMapping("exit.action")
	// 按条件查询数据 (模糊查询)
	@RequestMapping("queryCityByCond.action")
	public String queryCityByCond(String cond, String name, String number) {
		City city = new City();
		if (cond != null) {
			if ("cityname".equals(cond)) {
				city.setCityname(name);
			}
		}

		List<String> nameList = new ArrayList<String>();
		List<String> valueList = new ArrayList<String>();
		nameList.add(cond);
		valueList.add(name);
		PageHelper.getPage(this.cityService.getCityByLike(city), "city", nameList, valueList, 10, number, this.getRequest(), "query");
		name = null;
		cond = null;
		return "admin/querycity";
	}

	// 按主键查询数据
	@RequestMapping("getCityById.action")
	public String getCityById(String id) {
		City city = this.cityService.getCityById(id);
		this.getRequest().setAttribute("city", city);
		return "admin/editcity";
	}

	public CityService getCityService() {
		return cityService;
	}

	public void setCityService(CityService cityService) {
		this.cityService = cityService;
	}

}

			return "redirect:/index/preLogin.action";
		}
		return "users/usercenter";
	}

	@RequestMapping("userinfo.action")
	public String userinfo() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		this.getSession().setAttribute("users", this.usersService.getUsersById(userid));
		return "users/userinfo";
	}

	@RequestMapping("personal.action")
	public String personal(Users users) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		this.usersService.updateUsers(users);
		return "redirect:/index/userinfo.action";
	}

	// 添加产品到购物车
	@RequestMapping("addcart.action")
	public String addcart() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Cart cart = new Cart();
		cart.setFilmid(getRequest().getParameter("goodsid"));
		cart.setNum(getRequest().getParameter("num"));
		cart.setPrice(getRequest().getParameter("price"));
		cart.setUsersid(userid);
		this.cartService.insertCart(cart);
		return "redirect:/index/cart.action";
	}

	// 查看购物车
	@RequestMapping("cart.action")
	public String cart() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		cart.setUsersid(userid);
		List<Cart> cartList = this.cartService.getCartByCond(cart);
		this.getRequest().setAttribute("cartList", cartList);
		return "users/cart";
	}

	// 删除购物车中的产品
	@RequestMapping("deletecart.action")
	public String deletecart(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		this.cartService.deleteCart(id);
		return "redirect:/index/cart.action";
	}

	// 准备结算
	@RequestMapping("preCheckout.action")
	public String preCheckout() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Cart cart = new Cart();
		cart.setUsersid(userid);
		List<Cart> cartList = this.cartService.getCartByCond(cart);
		if (cartList.size() == 0) {
			this.getSession().setAttribute("message", "请选购商品");
			return "redirect:/index/cart.action";
		}
		List<City> cityList = this.cityService.getAllCity();
		this.getRequest().setAttribute("cityList", cityList);
		return "users/checkout";
	}

	// 结算
	@RequestMapping("checkout.action")
	public String checkout() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Cart cart1 = new Cart();

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/cinema", produces = "text/plain;charset=utf-8")
public class CinemaAction extends BaseAction {
	// 注入Service 由于标签的存在 所以不需要getter setter
	@Autowired
	@Resource
	private CinemaService cinemaService;
	@Autowired
	@Resource
	private CityService cityService;

	// 准备添加数据
	@RequestMapping("createCinema.action")
	public String createCinema() {
		List<City> cityList = this.cityService.getAllCity();
		this.getRequest().setAttribute("cityList", cityList);
		return "admin/addcinema";
	}

	// 添加数据
	@RequestMapping("addCinema.action")
	public String addCinema(Cinema cinema) {
		this.cinemaService.insertCinema(cinema);
		return "redirect:/cinema/createCinema.action";
	}

	// 通过主键删除数据
	@RequestMapping("deleteCinema.action")
	public String deleteCinema(String id) {
		this.cinemaService.deleteCinema(id);
		return "redirect:/cinema/getAllCinema.action";
	}

	// 批量删除数据
	@RequestMapping("deleteCinemaByIds.action")
	public String deleteCinemaByIds() {
		String[] ids = this.getRequest().getParameterValues("cinemaid");
}

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/cinema", produces = "text/plain;charset=utf-8")
public class CinemaAction extends BaseAction {
	// 注入Service 由于标签的存在 所以不需要getter setter
	@Autowired
	@Resource
	private CinemaService cinemaService;
	@Autowired
	@Resource
	private CityService cityService;

	// 准备添加数据
	@RequestMapping("createCinema.action")
	public String createCinema() {
		List<City> cityList = this.cityService.getAllCity();
		this.getRequest().setAttribute("cityList", cityList);
		return "admin/addcinema";
	}

	// 添加数据
	@RequestMapping("addCinema.action")
	public String addCinema(Cinema cinema) {
		this.cinemaService.insertCinema(cinema);
		return "redirect:/cinema/createCinema.action";
	}

	// 通过主键删除数据

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/cart", produces = "text/plain;charset=utf-8")
public class CartAction extends BaseAction {
	// 注入Service 由于标签的存在 所以不需要getter setter
	@Autowired
	@Resource
	private CartService cartService;
	@Autowired
	@Resource
	private UsersService usersService;
	@Autowired
	@Resource
	private FilmService filmService;

	// 准备添加数据
	@RequestMapping("createCart.action")
	public String createCart() {
		List<Users> usersList = this.usersService.getAllUsers();
		this.getRequest().setAttribute("usersList", usersList);
		List<Film> filmList = this.filmService.getAllFilm();
		this.getRequest().setAttribute("filmList", filmList);
		return "admin/addcart";
	}

	// 添加数据
	@RequestMapping("addCart.action")
	public String addCart(Cart cart) {
		this.cartService.insertCart(cart);
		return "redirect:/cart/createCart.action";
	}

	// 通过主键删除数据
	@RequestMapping("deleteCart.action")
	public String deleteCart(String id) {
		this.cartService.deleteCart(id);
		return "redirect:/cart/getAllCart.action";
	}

		}
		this.getRequest().setAttribute("id", id);
		return "users/pay";
	}

	// 付款
	@RequestMapping("pay.action")
	public String pay(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		Orders orders = this.ordersService.getOrdersById(this.getRequest().getParameter("id"));
		orders.setStatus("已付款");
		this.ordersService.updateOrders(orders);
		return "redirect:/index/showOrders.action";
	}

	// 确认收货
	@RequestMapping("over.action")
	public String over(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		Orders orders = this.ordersService.getOrdersById(this.getRequest().getParameter("id"));
		orders.setStatus("已收货");
		this.ordersService.updateOrders(orders);
		return "redirect:/index/showOrders.action";
	}

	// 取消订单
	@RequestMapping("cancel.action")
	public String cancel(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		Orders orders = this.ordersService.getOrdersById(this.getRequest().getParameter("id"));
		orders.setStatus("已取消");
		this.ordersService.updateOrders(orders);
		return "redirect:/index/showOrders.action";
	}

	// 订单明细
	@RequestMapping("orderdetail.action")
	public String orderdetail(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
// 设置路径
@RequestMapping(value = "/city", produces = "text/plain;charset=utf-8")
public class CityAction extends BaseAction {
	// 注入Service 由于标签的存在 所以不需要getter setter
	@Autowired
	@Resource
	private CityService cityService;

	// 准备添加数据
	@RequestMapping("createCity.action")
	public String createCity() {
		return "admin/addcity";
	}

	// 添加数据
	@RequestMapping("addCity.action")
	public String addCity(City city) {
		this.cityService.insertCity(city);
		return "redirect:/city/createCity.action";
	}

	// 通过主键删除数据
	@RequestMapping("deleteCity.action")
	public String deleteCity(String id) {
		this.cityService.deleteCity(id);
		return "redirect:/city/getAllCity.action";
	}

	// 批量删除数据
	@RequestMapping("deleteCityByIds.action")
	public String deleteCityByIds() {
		String[] ids = this.getRequest().getParameterValues("cityid");
		for (String cityid : ids) {
			this.cityService.deleteCity(cityid);
		}
		return "redirect:/city/getAllCity.action";
	}

	// 更新数据
	@RequestMapping("updateCity.action")
	public String updateCity(City city) {
		this.cityService.updateCity(city);
		return "redirect:/city/getAllCity.action";
	}

	// 显示全部数据
	@RequestMapping("getAllCity.action")
	public String getAllCity(String number) {
		String userid = (String) this.getSession().getAttribute("userid");
		topic.setAddtime(VeDate.getStringDateShort());
		topic.setContents(this.getRequest().getParameter("contents"));
		topic.setFilmid(this.getRequest().getParameter("goodsid"));
		topic.setNum(this.getRequest().getParameter("num"));
		topic.setUsersid(userid);
		this.topicService.insertTopic(topic);
		return "redirect:/index/detail.action?id=" + topic.getFilmid();
	}

}

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/admin", produces = "text/plain;charset=utf-8")
public class AdminAction extends BaseAction {
	// 注入Service 由于标签的存在 所以不需要getter setter
	@Autowired
	@Resource
	private AdminService adminService;

	// 管理员登录 1 验证用户名是否存在 2 验证密码是否正确
	@RequestMapping("login.action")
	public String login() {
		String username = this.getRequest().getParameter("username");
		String password = this.getRequest().getParameter("password");
		Admin adminEntity = new Admin();
		adminEntity.setUsername(username);
		List<Admin> adminlist = this.adminService.getAdminByCond(adminEntity);
		if (adminlist.size() == 0) {
			this.getRequest().setAttribute("message", "用户名不存在");
			return "admin/index";
		} else {
			Admin admin = adminlist.get(0);
			if (password.equals(admin.getPassword())) {
			buffer.append("下一页");
		} else {
			buffer.append("<a href=\"index/cate.action?number=" + (Integer.parseInt(number) + 1) + "&id=\" + id+ \"\">下一页</a>");
		}
		buffer.append("&nbsp;&nbsp;");
		if (maxPage <= (Integer.parseInt(number) + 1)) {
			buffer.append("尾页");
		} else {
			buffer.append("<a href=\"index/cate.action?number=" + (maxPage - 1) + "&id=\" + id+ \"\">尾页</a>");
		}
		html = buffer.toString();
		this.getRequest().setAttribute("html", html);
		this.getRequest().setAttribute("flimList", flimList);
		return "users/list";
	}

	// 推荐产品
	@RequestMapping("recommend.action")
	public String recommend(String number) {
		this.front();
		Film goods = new Film();
		goods.setRecommend("是");
		List<Film> flimList = new ArrayList<Film>();
		List<Film> tempList = this.filmService.getFilmByCond(goods);
		int pageNumber = tempList.size();
		int maxPage = pageNumber;
		if (maxPage % 12 == 0) {
			maxPage = maxPage / 12;
		} else {
			maxPage = maxPage / 12 + 1;
		}
		if (number == null) {
			number = "0";
		}
		int start = Integer.parseInt(number) * 12;
		int over = (Integer.parseInt(number) + 1) * 12;
		int count = pageNumber - over;
		if (count <= 0) {
			over = pageNumber;
		}
		for (int i = start; i < over; i++) {
			Film x = tempList.get(i);
			flimList.add(x);
		}
		String html = "";
		HttpSession session = null;
		try {
			session = this.getRequest().getSession();
		} catch (Exception e) {
		}
		return session;
	}

	/* 向客户端输出操作成功或失败信息 */
	public void writeJsonResponse(String success) throws IOException, JSONException {
		ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
		HttpServletResponse response = attrs.getResponse();
		response.setContentType("text/json;charset=UTF-8");
		PrintWriter out = response.getWriter();
		// 将要被返回到客户端的对象
		JSONObject json = new JSONObject();
		json.accumulate("result", success);
		System.out.println(json.toString());
		out.println(json.toString());
		out.flush();
		out.close();
	}
}

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/ajax", produces = "text/plain;charset=utf-8")
public class AjaxAction extends BaseAction {

	@Autowired
	@Resource
	private CinemaService cinemaService;

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

转载请注明出处或者链接地址:https://www.qianduange.cn//article/13486.html
标签
评论
发布的文章
大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!