资源简介

maven搭建的项目。使用Spring MVC+Spring+Mybatis+Mysql(包含SQL脚本),导入sql脚本后,项目可以正常运行。

资源截图

代码片段和文件信息

package com.lz.controller;

import java.io.IOException;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.lz.pojo.House;
import com.lz.pojo.HouseType;
import com.lz.pojo.User;
import com.lz.service.HouseService;
import com.lz.service.HouseTypeService;
import com.lz.service.UserService;

@Controller
@RequestMapping(value = “/House“)
public class CarController {
@Resource
HouseService houseService;
@Resource
HouseTypeService houseTypeService;
@Resource
UserService userService;

@RequestMapping(value = “/HouseAdd“ method = RequestMethod.GET)
public void addDoGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
// 查询房屋类型
List houseList = houseTypeService.query(null);
request.setAttribute(“houseList“ houseList);
// 查询房屋管理者

List userList = userService.getList(null null);
request.setAttribute(“userList“ userList);

request.getRequestDispatcher(“/view/house/house_add.jsp“).forward(request response);
}

@RequestMapping(value = “/HouseAdd“ method = RequestMethod.POST)
public void addDoPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
request.setCharacterEncoding(“utf-8“);// 处理乱码

String houseType = request.getParameter(“houseType“);
String userName = request.getParameter(“userName“);
String houseAddress = request.getParameter(“houseAddress“);
String housePrice = request.getParameter(“housePrice“);
String houseAmbient = request.getParameter(“houseAmbient“);

House houseInfo = new House();

try {
houseInfo.setUserId(Integer.parseInt(userName));
houseInfo.setHousePrice(Double.parseDouble(housePrice));
houseInfo.setTypeId(Integer.parseInt(houseType));
} catch (Exception e) {
e.printStackTrace();
}
houseInfo.setHouseAddress(houseAddress);
houseInfo.setHouseAmbient(houseAmbient);

boolean mark = houseService.add(houseInfo);
if (mark) {
request.setAttribute(“info“ “房屋添加成功“);
} else {
request.setAttribute(“info“ “房屋添加失败“);
}

// 转发
request.getRequestDispatcher(“/view/house/house_save.jsp“).forward(request response);
}

@RequestMapping(value = “/HouseDelete“ method = RequestMethod.GET)
public void deleteDoGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
try {
// 获取房屋编号
String houseid = request.getParameter(“houseId“);
int HouseId = Integer.parseInt(houseid);

boolean mark = houseService.delete(HouseId);
if (mark) {
request.setAttribute(“info“ “用户删除成功“);
} else {

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-04-05 09:26  CRMlz\
     文件        1515  2017-01-20 10:32  CRMlz\.classpath
     目录           0  2017-04-05 09:26  CRMlz\.externalToolBuilders\
     文件         548  2017-04-04 20:11  CRMlz\.externalToolBuilders\org.eclipse.wst.jsdt.core.javascriptValidator.launch
     文件        1289  2017-04-05 09:26  CRMlz\.project
     目录           0  2017-04-05 09:26  CRMlz\.settings\
     文件         639  2017-01-02 21:01  CRMlz\.settings\.jsdtscope
     文件         160  2017-01-20 10:33  CRMlz\.settings\org.eclipse.core.resources.prefs
     文件        7137  2017-01-20 10:15  CRMlz\.settings\org.eclipse.jdt.core.prefs
     文件          90  2017-01-02 21:01  CRMlz\.settings\org.eclipse.m2e.core.prefs
     文件         650  2017-01-20 10:31  CRMlz\.settings\org.eclipse.wst.common.component
     文件         321  2017-01-20 09:45  CRMlz\.settings\org.eclipse.wst.common.project.facet.core.prefs.xml
     文件         346  2017-01-20 10:32  CRMlz\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2017-01-02 21:01  CRMlz\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2017-01-02 21:01  CRMlz\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件          50  2017-01-02 21:01  CRMlz\.settings\org.eclipse.wst.validation.prefs
     目录           0  2017-04-05 09:26  CRMlz\logs\
     文件      473338  2017-01-20 10:34  CRMlz\logs\ssm.log
     文件        5476  2017-04-18 18:53  CRMlz\pom.xml
     目录           0  2017-04-05 09:26  CRMlz\src\
     目录           0  2017-04-05 09:26  CRMlz\src\main\
     目录           0  2017-04-05 09:26  CRMlz\src\main\java\
     目录           0  2017-04-05 09:26  CRMlz\src\main\java\com\
     目录           0  2017-04-17 21:41  CRMlz\src\main\java\com\lz\
     目录           0  2017-04-18 18:13  CRMlz\src\main\java\com\lz\controller\
     文件        7753  2017-04-18 18:13  CRMlz\src\main\java\com\lz\controller\CarController.java
     文件        2558  2017-04-18 18:13  CRMlz\src\main\java\com\lz\controller\CarTypeController.java
     文件        6826  2017-04-05 15:43  CRMlz\src\main\java\com\lz\controller\CustomerCareController.java
     文件        2850  2017-04-05 15:43  CRMlz\src\main\java\com\lz\controller\CustomerConditionController.java
     文件       18024  2017-06-02 10:50  CRMlz\src\main\java\com\lz\controller\CustomerController.java
     文件        2593  2017-04-05 15:43  CRMlz\src\main\java\com\lz\controller\CustomerSourceController.java
............此处省略994个文件信息

评论

共有 条评论