大家好,欢迎来到IT知识分享网。
今天主要是进入个人中心后点击实名认证后,实现实名认证和删除认证
效果如下
代码、结构如下
代码如下
UserAuth
package com.yiju.bean; / * 用户认证实体类 */ public class UserAuth { private int authId; //认证id private int userId; //用户id private String userName; //用户姓名 private int userGender; //性别 private String userCard; //身份证号码 private String userCardAddress; //身份证住址 private String userLiveAddress; //住址 private String userCarding; //证件照 private String userPropertyimg; //房产证照片 private int authStatus;//认证状态 private int isDelete; //是否已删除 0-未删除 1-已删除 private long createTime; //创建时间 private long updateTime; //更新时间 public int getAuthId() { return authId; } public void setAuthId(int authId) { this.authId = authId; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public int getUserGender() { return userGender; } public void setUserGender(int userGender) { this.userGender = userGender; } public String getUserCard() { return userCard; } public void setUserCard(String userCard) { this.userCard = userCard; } public String getUserCardAddress() { return userCardAddress; } public void setUserCardAddress(String userCardAddress) { this.userCardAddress = userCardAddress; } public String getUserLiveAddress() { return userLiveAddress; } public void setUserLiveAddress(String userLiveAddress) { this.userLiveAddress = userLiveAddress; } public String getUserCarding() { return userCarding; } public void setUserCarding(String userCarding) { this.userCarding = userCarding; } public String getUserPropertyimg() { return userPropertyimg; } public void setUserPropertyimg(String userPropertyimg) { this.userPropertyimg = userPropertyimg; } public int getAuthStatus() { return authStatus; } public void setAuthStatus(int authStatus) { this.authStatus = authStatus; } public int getIsDelete() { return isDelete; } public void setIsDelete(int isDelete) { this.isDelete = isDelete; } public long getCreateTime() { return createTime; } public void setCreateTime(long createTime) { this.createTime = createTime; } public long getUpdateTime() { return updateTime; } public void setUpdateTime(long updateTime) { this.updateTime = updateTime; } @Override public String toString() { return "UserAuth{" + "authId=" + authId + ", userId=" + userId + ", userName='" + userName + '\'' + ", userGender=" + userGender + ", userCard='" + userCard + '\'' + ", userCardAddress='" + userCardAddress + '\'' + ", userLiveAddress='" + userLiveAddress + '\'' + ", userCarding='" + userCarding + '\'' + ", userPropertyimg='" + userPropertyimg + '\'' + ", authStatus=" + authStatus + ", isDelete=" + isDelete + ", createTime=" + createTime + ", updateTime=" + updateTime + '}'; } }
House
package com.yiju.bean; import java.math.BigDecimal; / * 房屋表 */ public class House { private int houseId; //房源表唯一标识ID private int userId; //发布此房源的用户ID private int houseType; //房源类型 0:新房 1:旧房 2:租房 private String houseTitle; //房源帖子标题 private String houseHeadimg; //房源帖子头像 private String housePlanimg1; //房屋户型平面图1 外键 private String housePlanimg2; //房屋户型平面图2 外键 private String houseImg1; //房源室内图1 private String houseImg2; //房源室内图2 private String houseImg3; //房源室内图3 private String houseImg4; //房源室内图4 private String houseImg5; //房源室内图5 private String houseImg6; //房源室内图6 private BigDecimal housePrice; //房源预计售价 private String priceUnit; //售价单位 元/每月 元/每套 元/每年 private String houseAddress; //房源地址 private int isDelete; //0:未删除 1:已删除 private long createTime; //创建时间 private long updateTime; //更新时间 public int getHouseId() { return houseId; } public void setHouseId(int houseId) { this.houseId = houseId; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public int getHouseType() { return houseType; } public void setHouseType(int houseType) { this.houseType = houseType; } public String getHouseTitle() { return houseTitle; } public void setHouseTitle(String houseTitle) { this.houseTitle = houseTitle; } public String getHouseHeadimg() { return houseHeadimg; } public void setHouseHeadimg(String houseHeadimg) { this.houseHeadimg = houseHeadimg; } public String getHousePlanimg1() { return housePlanimg1; } public void setHousePlanimg1(String housePlanimg1) { this.housePlanimg1 = housePlanimg1; } public String getHousePlanimg2() { return housePlanimg2; } public void setHousePlanimg2(String housePlanimg2) { this.housePlanimg2 = housePlanimg2; } public String getHouseImg1() { return houseImg1; } public void setHouseImg1(String houseImg1) { this.houseImg1 = houseImg1; } public String getHouseImg2() { return houseImg2; } public void setHouseImg2(String houseImg2) { this.houseImg2 = houseImg2; } public String getHouseImg3() { return houseImg3; } public void setHouseImg3(String houseImg3) { this.houseImg3 = houseImg3; } public String getHouseImg4() { return houseImg4; } public void setHouseImg4(String houseImg4) { this.houseImg4 = houseImg4; } public String getHouseImg5() { return houseImg5; } public void setHouseImg5(String houseImg5) { this.houseImg5 = houseImg5; } public String getHouseImg6() { return houseImg6; } public void setHouseImg6(String houseImg6) { this.houseImg6 = houseImg6; } public BigDecimal getHousePrice() { return housePrice; } public void setHousePrice(BigDecimal housePrice) { this.housePrice = housePrice; } public String getPriceUnit() { return priceUnit; } public void setPriceUnit(String priceUnit) { this.priceUnit = priceUnit; } public String getHouseAddress() { return houseAddress; } public void setHouseAddress(String houseAddress) { this.houseAddress = houseAddress; } public int getIsDelete() { return isDelete; } public void setIsDelete(int isDelete) { this.isDelete = isDelete; } public long getCreateTime() { return createTime; } public void setCreateTime(long createTime) { this.createTime = createTime; } public long getUpdateTime() { return updateTime; } public void setUpdateTime(long updateTime) { this.updateTime = updateTime; } @Override public String toString() { return "House{" + "houseId=" + houseId + ", userId=" + userId + ", houseType=" + houseType + ", houseTitle='" + houseTitle + '\'' + ", houseHeadimg='" + houseHeadimg + '\'' + ", housePlanimg1='" + housePlanimg1 + '\'' + ", housePlanimg2='" + housePlanimg2 + '\'' + ", houseImg1='" + houseImg1 + '\'' + ", houseImg2='" + houseImg2 + '\'' + ", houseImg3='" + houseImg3 + '\'' + ", houseImg4='" + houseImg4 + '\'' + ", houseImg5='" + houseImg5 + '\'' + ", houseImg6='" + houseImg6 + '\'' + ", housePrice=" + housePrice + ", priceUnit='" + priceUnit + '\'' + ", houseAddress='" + houseAddress + '\'' + ", isDelete=" + isDelete + ", createTime=" + createTime + ", updateTime=" + updateTime + '}'; } }
HouseInfo
package com.yiju.bean; / * 房屋信息表 */ public class HouseInfo { private int infoId; //房源详细信息表唯一标识ID private int houseId; //对应房源表唯一ID private String houseNature; //房源性质:商品房 住宅房 private String houseModel; //普通式住宅 公寓式住宅 别墅 独栋 private int houseYear; //房源建造时间 private String houseValid; //房源期限: 70年、100年、永久 private String houseLayout; //房源户型:几室几厅几卫 private String houseArea; //房源面积 private String houseTurn; //朝向 private int houseFloor; //楼层 private int floorAll; //总楼层 private String houseDecorate; //装饰类型:精装 简装 private String houseLift; //是否有电梯: 0无 1有 private long createTime; //创建时间 private long updateTime; //更新时间 public int getInfoId() { return infoId; } public void setInfoId(int infoId) { this.infoId = infoId; } public int getHouseId() { return houseId; } public void setHouseId(int houseId) { this.houseId = houseId; } public String getHouseNature() { return houseNature; } public void setHouseNature(String houseNature) { this.houseNature = houseNature; } public String getHouseModel() { return houseModel; } public void setHouseModel(String houseModel) { this.houseModel = houseModel; } public int getHouseYear() { return houseYear; } public void setHouseYear(int houseYear) { this.houseYear = houseYear; } public String getHouseValid() { return houseValid; } public void setHouseValid(String houseValid) { this.houseValid = houseValid; } public String getHouseLayout() { return houseLayout; } public void setHouseLayout(String houseLayout) { this.houseLayout = houseLayout; } public String getHouseArea() { return houseArea; } public void setHouseArea(String houseArea) { this.houseArea = houseArea; } public String getHouseTurn() { return houseTurn; } public void setHouseTurn(String houseTurn) { this.houseTurn = houseTurn; } public int getHouseFloor() { return houseFloor; } public void setHouseFloor(int houseFloor) { this.houseFloor = houseFloor; } public int getFloorAll() { return floorAll; } public void setFloorAll(int floorAll) { this.floorAll = floorAll; } public String getHouseDecorate() { return houseDecorate; } public void setHouseDecorate(String houseDecorate) { this.houseDecorate = houseDecorate; } public String getHouseLift() { return houseLift; } public void setHouseLift(String houseLift) { this.houseLift = houseLift; } public long getCreateTime() { return createTime; } public void setCreateTime(long createTime) { this.createTime = createTime; } public long getUpdateTime() { return updateTime; } public void setUpdateTime(long updateTime) { this.updateTime = updateTime; } @Override public String toString() { return "HouseInfo{" + "infoId=" + infoId + ", houseId=" + houseId + ", houseNature='" + houseNature + '\'' + ", houseModel='" + houseModel + '\'' + ", houseYear=" + houseYear + ", houseValid='" + houseValid + '\'' + ", houseLayout='" + houseLayout + '\'' + ", houseArea='" + houseArea + '\'' + ", houseTurn='" + houseTurn + '\'' + ", houseFloor=" + houseFloor + ", floorAll=" + floorAll + ", houseDecorate='" + houseDecorate + '\'' + ", houseLift='" + houseLift + '\'' + ", createTime=" + createTime + ", updateTime=" + updateTime + '}'; } }
HouseInter
package com.yiju.bean; / * 出租房屋内饰表 */ public class HouseInter { private int interId; //内饰表ID private int houseId; //对应房源id private int bed; //床:0无 1有 private int washing; //洗衣机:0无 1有 private int air; //空调: 0无 1有 private int balcony; //阳台:0无 1有 private int ice; //冰箱:0无 1有 private int toilet; //卫生间:0无 1有 private int kitchen; //厨房:0无 1有 private int tv; //电视:0无 1有 private int heater; //热水器:0无 1有 private int wardrobe; //衣柜:0无 1有 private int heating; //暖气:0无 1有 private int internet; //宽带:0无 1有 private int sofa; //沙发:0无 1有 private long createTime; //创建时间 private long updateTime; //更新时间 public int getInterId() { return interId; } public void setInterId(int interId) { this.interId = interId; } public int getHouseId() { return houseId; } public void setHouseId(int houseId) { this.houseId = houseId; } public int getBed() { return bed; } public void setBed(int bed) { this.bed = bed; } public int getWashing() { return washing; } public void setWashing(int washing) { this.washing = washing; } public int getAir() { return air; } public void setAir(int air) { this.air = air; } public int getBalcony() { return balcony; } public void setBalcony(int balcony) { this.balcony = balcony; } public int getIce() { return ice; } public void setIce(int ice) { this.ice = ice; } public int getToilet() { return toilet; } public void setToilet(int toilet) { this.toilet = toilet; } public int getKitchen() { return kitchen; } public void setKitchen(int kitchen) { this.kitchen = kitchen; } public int getTv() { return tv; } public void setTv(int tv) { this.tv = tv; } public int getHeater() { return heater; } public void setHeater(int heater) { this.heater = heater; } public int getWardrobe() { return wardrobe; } public void setWardrobe(int wardrobe) { this.wardrobe = wardrobe; } public int getHeating() { return heating; } public void setHeating(int heating) { this.heating = heating; } public int getInternet() { return internet; } public void setInternet(int internet) { this.internet = internet; } public int getSofa() { return sofa; } public void setSofa(int sofa) { this.sofa = sofa; } public long getCreateTime() { return createTime; } public void setCreateTime(long createTime) { this.createTime = createTime; } public long getUpdateTime() { return updateTime; } public void setUpdateTime(long updateTime) { this.updateTime = updateTime; } @Override public String toString() { return "HouseInter{" + "interId=" + interId + ", houseId=" + houseId + ", bed=" + bed + ", washing=" + washing + ", air=" + air + ", balcony=" + balcony + ", ice=" + ice + ", toilet=" + toilet + ", kitchen=" + kitchen + ", tv=" + tv + ", heater=" + heater + ", wardrobe=" + wardrobe + ", heating=" + heating + ", internet=" + internet + ", sofa=" + sofa + ", createTime=" + createTime + ", updateTime=" + updateTime + '}'; } }
UserInfo
package com.yiju.bean; public class UserInfo { public UserInfo() { } public UserInfo(int userId, String nickname, String truename, int gender, String city, long createTime) { this.userId = userId; this.nickname = nickname; this.truename = truename; this.gender = gender; this.city = city; this.createTime = createTime; } private int userId; //用户id private String phone; //用户手机号,用于登录 private String password; //密码 private String email; //邮箱 private String nickname; //昵称 private String truename; //真实姓名 private int gender; //性别 0:男 1:女 private String province; //省份 private String city; //城市 private int isDelete; //是否删除 0:未删除 1:已删除 private long createTime; //创建时间 private long updateTime; //更新时间 public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public String getTruename() { return truename; } public void setTruename(String truename) { this.truename = truename; } public int getGender() { return gender; } public void setGender(int gender) { this.gender = gender; } public String getProvince() { return province; } public void setProvince(String province) { this.province = province; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public int getIsDelete() { return isDelete; } public void setIsDelete(int isDelete) { this.isDelete = isDelete; } public long getCreateTime() { return createTime; } public void setCreateTime(long createTime) { this.createTime = createTime; } public long getUpdateTime() { return updateTime; } public void setUpdateTime(long updateTime) { this.updateTime = updateTime; } @Override public String toString() { return "UserInfo{" + "userId=" + userId + ", phone='" + phone + '\'' + ", password='" + password + '\'' + ", email='" + email + '\'' + ", nickname='" + nickname + '\'' + ", truename='" + truename + '\'' + ", gender=" + gender + ", province='" + province + '\'' + ", city='" + city + '\'' + ", isDelete=" + isDelete + ", createTime=" + createTime + ", updateTime=" + updateTime + '}'; } }
HouseViewController
package com.yiju.controller; import com.github.pagehelper.PageInfo; import com.yiju.bean.House; import com.yiju.bean.HouseInfo; import com.yiju.bean.HouseInter; import com.yiju.pojo.HouseView; import com.yiju.service.IHouseViewService; import com.yiju.util.yijuUtil; import net.sf.json.JSONObject; import org.apache.ibatis.annotations.Param; import org.mortbay.util.ajax.JSONObjectConvertor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpSession; import javax.transaction.Transactional; import java.io.IOException; import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; @Controller @RequestMapping("house") public class HouseViewController { @Autowired private IHouseViewService houseViewService; @RequestMapping("findFourHouse.do") public ModelAndView findFourHouse() { ModelAndView mv = new ModelAndView(); List<HouseView> newHouses = houseViewService.findFourHouseByType(0); List<HouseView> oldHouses = houseViewService.findFourHouseByType(1); List<HouseView> rentHouses = houseViewService.findFourHouseByType(2); mv.addObject("newHouses", newHouses); mv.addObject("oldHouses", oldHouses); mv.addObject("rentHouses", rentHouses); mv.setViewName("../main"); return mv; } @RequestMapping("findHouseById.do") public ModelAndView findHouseById(int houseId) { HouseView house = houseViewService.findHouseByHouseId(houseId); ModelAndView mv = new ModelAndView(); mv.addObject("houseInfo", house); mv.setViewName("details"); return mv; } @RequestMapping("findHouse.do") public ModelAndView findHouseByType(@RequestParam(defaultValue = "1") int currentPage, int houseType) { ModelAndView mv = new ModelAndView(); List<HouseView> houses = houseViewService.findHouseByType(currentPage, houseType); List<HouseView> fh = houseViewService.findFourHouseByType(houseType); PageInfo<HouseView> pageInfo = new PageInfo<>(houses); mv.addObject("pageInfo", pageInfo); mv.addObject("fh", fh); if (houseType == 0) { mv.setViewName("newhouse"); } else if (houseType == 1) { mv.setViewName("oldhouse"); } else { mv.setViewName("renthouse"); } return mv; } @RequestMapping("toHousePost2.do") public ModelAndView toHousePost2( @Param(value = "houseTitle") String houseTitle, @Param(value = "houseAddress") String houseAddress, @Param(value = "housePrice") BigDecimal housePrice, @Param(value = "priceUnit") String priceUnit, @Param(value = "houseHeadimg") MultipartFile houseHeadimg, @Param(value = "housePlanimg1") MultipartFile housePlanimg1, @Param(value = "housePlanimg2") MultipartFile housePlanimg2, @Param(value = "houseImg1") MultipartFile houseImg1, @Param(value = "houseImg2") MultipartFile houseImg2, @Param(value = "houseImg3") MultipartFile houseImg3, @Param(value = "houseImg4") MultipartFile houseImg4, @Param(value = "houseImg5") MultipartFile houseImg5, @Param(value = "houseImg6") MultipartFile houseImg6, HttpSession session ) throws IOException { House house = new House(); house.setHouseTitle(houseTitle); house.setHouseAddress(houseAddress); house.setHousePrice(housePrice); house.setPriceUnit(priceUnit); Map<String,byte[]> images = new HashMap<>(); if (houseHeadimg.getSize() != 0) { String picName = yijuUtil.getPicName(); house.setHouseHeadimg(picName); images.put(picName, houseHeadimg.getBytes()); } if (housePlanimg1.getSize()!=0){ String picName = yijuUtil.getPicName(); house.setHouseHeadimg(picName); images.put(picName,housePlanimg1.getBytes()); } if (housePlanimg2.getSize()!=0){ String picName = yijuUtil.getPicName(); house.setHouseHeadimg(picName); images.put(picName,housePlanimg2.getBytes()); } if (houseImg1.getSize()!=0){ String picName = yijuUtil.getPicName(); house.setHouseHeadimg(picName); images.put(picName,houseImg1.getBytes()); } if (houseImg2.getSize()!=0){ String picName = yijuUtil.getPicName(); house.setHouseHeadimg(picName); images.put(picName,houseImg2.getBytes()); } if (houseImg3.getSize()!=0){ String picName = yijuUtil.getPicName(); house.setHouseHeadimg(picName); images.put(picName,houseImg3.getBytes()); } if (houseImg4.getSize()!=0){ String picName =yijuUtil.getPicName(); house.setHouseHeadimg(picName); images.put(picName,houseImg4.getBytes()); } if (houseImg5.getSize()!=0){ String picName = yijuUtil.getPicName(); house.setHouseHeadimg(picName); images.put(picName,houseImg5.getBytes()); } if (houseImg6.getSize()!=0){ String picName = yijuUtil.getPicName(); house.setHouseHeadimg(picName); images.put(picName,houseImg6.getBytes()); } // Set<String> Keys=images.keySet(); // for (String Key:Keys){ // MultipartFile file=images.get(Key); // yijuUtil.upload(file.getBytes(),Key); // } session.setAttribute("house",house); session.setAttribute("images",images); // // houseViewService.postHouse(house); ModelAndView mv=new ModelAndView(); mv.setViewName("housePost2"); return mv; } @RequestMapping("responsePost2.do") @ResponseBody public String responsePost2(HouseInfo houseInfo,HttpSession session){ // houseInfo.setHouseId(10001); // houseViewService.postHouseInfo(houseInfo); session.setAttribute("houseInfo",houseInfo); return new JSONObject().toString(); } @RequestMapping("responsePost3.do") @ResponseBody public String responsePost3(HouseInter houseInter,HttpSession session){ // houseInter.setHouseId(10013); // houseViewService.postHouseInter(houseInter); session.setAttribute("houseInter",houseInter); return new JSONObject().toString(); } @RequestMapping("doHousePost.do") @Transactional public String doHousePost(HttpSession session) throws IOException { House house =(House) session.getAttribute("house"); house.setUserId(10001); Map<String,byte[]> images=( Map<String,byte[]> ) session.getAttribute("images"); HouseInfo houseInfo=(HouseInfo) session.getAttribute("houseInfo"); HouseInter houseInter=(HouseInter) session.getAttribute("houseInter"); houseViewService.postHouse(house); Set<String> keys=images.keySet(); for(String key:keys){ byte[] bytes=images.get(key); yijuUtil.upload(bytes,key); } houseInfo.setHouseId(house.getHouseId()); houseViewService.postHouseInfo(houseInfo); houseInter.setHouseId(house.getHouseId()); houseViewService.postHouseInter(houseInter); return "redirect:findHouseById.do?houseId="+house.getHouseId(); } }
UserController
package com.yiju.controller; import com.yiju.bean.UserAuth; import com.yiju.bean.UserInfo; import com.yiju.service.IUserService; import net.sf.json.JSONObject; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpSession; import java.util.Date; @Controller @RequestMapping("user") public class UserController { @Autowired private IUserService userService; @RequestMapping("login.do") @ResponseBody public String login(@Param(value = "username") String username, @Param(value = "password") String password){ if ("123".equals(username)&&"123".equals(password)){ return "success"; } return "fail"; } @RequestMapping("login1.do") @ResponseBody public String login1(@Param(value = "username") String username, @Param(value = "password") String password){ JSONObject jsonObject=new JSONObject(); if ("123".equals(username)&&"123".equals(password)){ jsonObject.put("result","1"); }else { jsonObject.put("result","2"); } return jsonObject.toString(); } @RequestMapping("login2.do") @ResponseBody public String login2(@Param(value = "phone") String phone, @Param(value = "password") String password, HttpSession session){ JSONObject jsonObject=new JSONObject(); UserInfo user=userService.findUserByPhone(phone); if (user==null){ jsonObject.put("result","0"); }else if (!password.equals(user.getPassword())){ jsonObject.put("result","1"); }else { session.setAttribute("user",user); jsonObject.put("result","2"); } return jsonObject.toString(); } @RequestMapping("signup.do") @ResponseBody public String signup(@Param(value = "phone") String phone, @Param(value = "password") String password){ JSONObject jsonObject=new JSONObject(); UserInfo user=userService.findUserByPhone(phone); if (user==null){ userService.add(phone,password); jsonObject.put("result","0"); }else { jsonObject.put("result","1"); } return jsonObject.toString(); } @RequestMapping("saveEdit.do") @ResponseBody public String saveEdit(UserInfo userInfo,HttpSession session){ JSONObject jsonObject=new JSONObject(); UserInfo userInfo1= (UserInfo) session.getAttribute("user"); userInfo1.setTruename(userInfo.getTruename()); userInfo1.setNickname(userInfo.getNickname()); userInfo1.setGender(userInfo.getGender()); userInfo1.setCity(userInfo.getCity()); userService.updateUserInfo(userInfo1); session.setAttribute("user",userInfo1); return jsonObject.toString(); } @RequestMapping("verify.do") public ModelAndView verify(HttpSession session){ UserInfo user= (UserInfo) session.getAttribute("user"); UserAuth userAuth=userService.findUserAuth(user.getUserId()); session.setAttribute("userAuth",userAuth); ModelAndView modelAndView=new ModelAndView(); modelAndView.setViewName("verify"); return modelAndView; } @RequestMapping("saveAuth.do") @ResponseBody public String saveAuth(HttpSession session,UserAuth userAuth ){ UserInfo user= (UserInfo) session.getAttribute("user"); userAuth.setUserName(user.getTruename()); userAuth.setUserGender(user.getGender()); userAuth.setUserId(user.getUserId()); userAuth.setCreateTime(new Date().getTime()); userAuth.setUpdateTime(new Date().getTime()); userService.postUserAuth(userAuth); return new JSONObject().toString(); } @RequestMapping("deleteAuth.do") public ModelAndView deleteAuth(HttpSession session ){ UserInfo user= (UserInfo) session.getAttribute("user"); userService.deleteById(user.getUserId()); ModelAndView modelAndView=new ModelAndView(); modelAndView.setViewName("personal"); return modelAndView; } @RequestMapping("upps.do") @ResponseBody public String upps(HttpSession session,String oldpassword,String password ){ UserInfo user= (UserInfo) session.getAttribute("user"); JSONObject jsonObject = new JSONObject(); if(!user.getPassword().equals(oldpassword)){ jsonObject.put("result",1); }else { //userService.upps(); jsonObject.put("result",2); } return jsonObject.toString(); } }
UserController
package com.yiju.controller; import com.yiju.bean.UserAuth; import com.yiju.bean.UserInfo; import com.yiju.service.IUserService; import net.sf.json.JSONObject; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpSession; import java.util.Date; @Controller @RequestMapping("user") public class UserController { @Autowired private IUserService userService; @RequestMapping("login.do") @ResponseBody public String login(@Param(value = "username") String username, @Param(value = "password") String password){ if ("123".equals(username)&&"123".equals(password)){ return "success"; } return "fail"; } @RequestMapping("login1.do") @ResponseBody public String login1(@Param(value = "username") String username, @Param(value = "password") String password){ JSONObject jsonObject=new JSONObject(); if ("123".equals(username)&&"123".equals(password)){ jsonObject.put("result","1"); }else { jsonObject.put("result","2"); } return jsonObject.toString(); } @RequestMapping("login2.do") @ResponseBody public String login2(@Param(value = "phone") String phone, @Param(value = "password") String password, HttpSession session){ JSONObject jsonObject=new JSONObject(); UserInfo user=userService.findUserByPhone(phone); if (user==null){ jsonObject.put("result","0"); }else if (!password.equals(user.getPassword())){ jsonObject.put("result","1"); }else { session.setAttribute("user",user); jsonObject.put("result","2"); } return jsonObject.toString(); } @RequestMapping("signup.do") @ResponseBody public String signup(@Param(value = "phone") String phone, @Param(value = "password") String password){ JSONObject jsonObject=new JSONObject(); UserInfo user=userService.findUserByPhone(phone); if (user==null){ userService.add(phone,password); jsonObject.put("result","0"); }else { jsonObject.put("result","1"); } return jsonObject.toString(); } @RequestMapping("saveEdit.do") @ResponseBody public String saveEdit(UserInfo userInfo,HttpSession session){ JSONObject jsonObject=new JSONObject(); UserInfo userInfo1= (UserInfo) session.getAttribute("user"); userInfo1.setTruename(userInfo.getTruename()); userInfo1.setNickname(userInfo.getNickname()); userInfo1.setGender(userInfo.getGender()); userInfo1.setCity(userInfo.getCity()); userService.updateUserInfo(userInfo1); session.setAttribute("user",userInfo1); return jsonObject.toString(); } @RequestMapping("verify.do") public ModelAndView verify(HttpSession session){ UserInfo user= (UserInfo) session.getAttribute("user"); UserAuth userAuth=userService.findUserAuth(user.getUserId()); session.setAttribute("userAuth",userAuth); ModelAndView modelAndView=new ModelAndView(); modelAndView.setViewName("verify"); return modelAndView; } @RequestMapping("saveAuth.do") @ResponseBody public String saveAuth(HttpSession session,UserAuth userAuth ){ UserInfo user= (UserInfo) session.getAttribute("user"); userAuth.setUserName(user.getTruename()); userAuth.setUserGender(user.getGender()); userAuth.setUserId(user.getUserId()); userAuth.setCreateTime(new Date().getTime()); userAuth.setUpdateTime(new Date().getTime()); userService.postUserAuth(userAuth); return new JSONObject().toString(); } @RequestMapping("deleteAuth.do") public ModelAndView deleteAuth(HttpSession session ){ UserInfo user= (UserInfo) session.getAttribute("user"); userService.deleteById(user.getUserId()); ModelAndView modelAndView=new ModelAndView(); modelAndView.setViewName("personal"); return modelAndView; } @RequestMapping("upps.do") @ResponseBody public String upps(HttpSession session,String oldpassword,String password ){ UserInfo user= (UserInfo) session.getAttribute("user"); JSONObject jsonObject = new JSONObject(); if(!user.getPassword().equals(oldpassword)){ jsonObject.put("result",1); }else { //userService.upps(); jsonObject.put("result",2); } return jsonObject.toString(); } }
IHouseViewDao
package com.yiju.dao; import com.yiju.bean.House; import com.yiju.bean.HouseInfo; import com.yiju.bean.HouseInter; import com.yiju.pojo.HouseView; import org.apache.ibatis.annotations.Param; import java.util.List; public interface IHouseViewDao { List<HouseView> findFourHouseByType(@Param("houseType") int houseType); HouseView findHouseByHouseId(@Param("houseId") int houseId); List<HouseView> findHouseByType(@Param("houseType") int houseType); void PostHouse(House house); void postHouseInfo(HouseInfo houseInfo); void postHouseInter(HouseInter houseInter); }
IUserDao
package com.yiju.dao; import com.yiju.bean.UserAuth; import com.yiju.bean.UserInfo; import org.apache.ibatis.annotations.Param; public interface IUserDao { UserInfo findUserByPhone(String phone); void signup(@Param("phone") String phone, @Param("password") String password); void updateUserInfo(UserInfo userInfo); UserAuth findUserAuthByUserId(int userId); void postUserAuth(UserAuth userAuth); void deleteById(int id); }
HouseView
package com.yiju.pojo; import java.math.BigDecimal; public class HouseView { private int houseId; //房源ID private String trueName; //发布人 private String houseTitle; //房源标题 private String houseHeadimg; //房源帖子头像 private BigDecimal housePrice; //房屋价格 private String priceUnit; //售价单位:元/每月 元/套 元/年 private int houseFloor; //楼层 private int floorAll; //全部楼层 private String houseAddress; //房源地址 private String houseLayout; //几室几厅几卫 private String houseDecorate; //精装,简装 private String houseArea; //房间面积 private long createTime; //创建时间 private String houseTurn; //房屋朝向 private String houseNature; //房屋性质 private String houseModel; //房屋类型 private String houseYear; //建造年份 private String houseValid; //有效期 private int houseLift; //是否有电梯 private String housePlanimg1; private String housePlanimg2; private String houseImg1; //房源室内图1 private String houseImg2; //房源室内图2 private String houseImg3; //房源室内图3 private String houseImg4; //房源室内图4 private String houseImg5; //房源室内图5 private String houseImg6; //房源室内图6 private String date; //获取年月日 private int bed; //床:0无 1有 private int washing; //洗衣机:0无 1有 private int air; //空调: 0无 1有 private int balcony; //阳台:0无 1有 private int ice; //冰箱:0无 1有 private int toilet; //卫生间:0无 1有 private int kitchen; //厨房:0无 1有 private int tv; //电视:0无 1有 private int heater; //热水器:0无 1有 private int wardrobe; //衣柜:0无 1有 private int heating; //暖气:0无 1有 private int internet; //宽带:0无 1有 private int sofa; //沙发:0无 1有 private int houseType; public int getHouseType() { return houseType; } public void setHouseType(int houseType) { this.houseType = houseType; } public int getHouseId() { return houseId; } public void setHouseId(int houseId) { this.houseId = houseId; } public String getTrueName() { return trueName; } public void setTrueName(String trueName) { this.trueName = trueName; } public String getHouseTitle() { return houseTitle; } public void setHouseTitle(String houseTitle) { this.houseTitle = houseTitle; } public String getHouseHeadimg() { return houseHeadimg; } public void setHouseHeadimg(String houseHeadimg) { this.houseHeadimg = houseHeadimg; } public BigDecimal getHousePrice() { return housePrice; } public void setHousePrice(BigDecimal housePrice) { this.housePrice = housePrice; } public String getPriceUnit() { return priceUnit; } public void setPriceUnit(String priceUnit) { this.priceUnit = priceUnit; } public int getHouseFloor() { return houseFloor; } public void setHouseFloor(int houseFloor) { this.houseFloor = houseFloor; } public int getFloorAll() { return floorAll; } public void setFloorAll(int floorAll) { this.floorAll = floorAll; } public String getHouseAddress() { return houseAddress; } public void setHouseAddress(String houseAddress) { this.houseAddress = houseAddress; } public String getHouseLayout() { return houseLayout; } public void setHouseLayout(String houseLayout) { this.houseLayout = houseLayout; } public String getHouseDecorate() { return houseDecorate; } public void setHouseDecorate(String houseDecorate) { this.houseDecorate = houseDecorate; } public String getHouseArea() { return houseArea; } public void setHouseArea(String houseArea) { this.houseArea = houseArea; } public long getCreateTime() { return createTime; } public void setCreateTime(long createTime) { this.createTime = createTime; } public String getHouseTurn() { return houseTurn; } public void setHouseTurn(String houseTurn) { this.houseTurn = houseTurn; } public String getHouseNature() { return houseNature; } public void setHouseNature(String houseNature) { this.houseNature = houseNature; } public String getHouseModel() { return houseModel; } public void setHouseModel(String houseModel) { this.houseModel = houseModel; } public String getHouseYear() { return houseYear; } public void setHouseYear(String houseYear) { this.houseYear = houseYear; } public String getHouseValid() { return houseValid; } public void setHouseValid(String houseValid) { this.houseValid = houseValid; } public int getHouseLift() { return houseLift; } public void setHouseLift(int houseLift) { this.houseLift = houseLift; } public String getHousePlanimg1() { return housePlanimg1; } public void setHousePlanimg1(String housePlanimg1) { this.housePlanimg1 = housePlanimg1; } public String getHousePlanimg2() { return housePlanimg2; } public void setHousePlanimg2(String housePlanimg2) { this.housePlanimg2 = housePlanimg2; } public String getHouseImg1() { return houseImg1; } public void setHouseImg1(String houseImg1) { this.houseImg1 = houseImg1; } public String getHouseImg2() { return houseImg2; } public void setHouseImg2(String houseImg2) { this.houseImg2 = houseImg2; } public String getHouseImg3() { return houseImg3; } public void setHouseImg3(String houseImg3) { this.houseImg3 = houseImg3; } public String getHouseImg4() { return houseImg4; } public void setHouseImg4(String houseImg4) { this.houseImg4 = houseImg4; } public String getHouseImg5() { return houseImg5; } public void setHouseImg5(String houseImg5) { this.houseImg5 = houseImg5; } public String getHouseImg6() { return houseImg6; } public void setHouseImg6(String houseImg6) { this.houseImg6 = houseImg6; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public int getBed() { return bed; } public void setBed(int bed) { this.bed = bed; } public int getWashing() { return washing; } public void setWashing(int washing) { this.washing = washing; } public int getAir() { return air; } public void setAir(int air) { this.air = air; } public int getBalcony() { return balcony; } public void setBalcony(int balcony) { this.balcony = balcony; } public int getIce() { return ice; } public void setIce(int ice) { this.ice = ice; } public int getToilet() { return toilet; } public void setToilet(int toilet) { this.toilet = toilet; } public int getKitchen() { return kitchen; } public void setKitchen(int kitchen) { this.kitchen = kitchen; } public int getTv() { return tv; } public void setTv(int tv) { this.tv = tv; } public int getHeater() { return heater; } public void setHeater(int heater) { this.heater = heater; } public int getWardrobe() { return wardrobe; } public void setWardrobe(int wardrobe) { this.wardrobe = wardrobe; } public int getHeating() { return heating; } public void setHeating(int heating) { this.heating = heating; } public int getInternet() { return internet; } public void setInternet(int internet) { this.internet = internet; } public int getSofa() { return sofa; } public void setSofa(int sofa) { this.sofa = sofa; } @Override public String toString() { return "HouseView{" + "houseId=" + houseId + ", trueName='" + trueName + '\'' + ", houseTitle='" + houseTitle + '\'' + ", houseHeadimg='" + houseHeadimg + '\'' + ", housePrice=" + housePrice + ", priceUnit='" + priceUnit + '\'' + ", houseFloor=" + houseFloor + ", floorAll=" + floorAll + ", houseAddress='" + houseAddress + '\'' + ", houseLayout='" + houseLayout + '\'' + ", houseDecorate='" + houseDecorate + '\'' + ", houseArea='" + houseArea + '\'' + ", createTime=" + createTime + ", houseTurn='" + houseTurn + '\'' + ", houseNature='" + houseNature + '\'' + ", houseModel='" + houseModel + '\'' + ", houseYear='" + houseYear + '\'' + ", houseValid='" + houseValid + '\'' + ", houseLift=" + houseLift + ", housePlanimg1='" + housePlanimg1 + '\'' + ", housePlanimg2='" + housePlanimg2 + '\'' + ", houseImg1='" + houseImg1 + '\'' + ", houseImg2='" + houseImg2 + '\'' + ", houseImg3='" + houseImg3 + '\'' + ", houseImg4='" + houseImg4 + '\'' + ", houseImg5='" + houseImg5 + '\'' + ", houseImg6='" + houseImg6 + '\'' + ", date='" + date + '\'' + ", bed=" + bed + ", washing=" + washing + ", air=" + air + ", balcony=" + balcony + ", ice=" + ice + ", toilet=" + toilet + ", kitchen=" + kitchen + ", tv=" + tv + ", heater=" + heater + ", wardrobe=" + wardrobe + ", heating=" + heating + ", internet=" + internet + ", sofa=" + sofa + ", houseType=" + houseType + '}'; } }
HouseViewService
package com.yiju.service.iml;
import java.util.List;
@Autowired private IHouseViewDao houseViewDao; @Override public List<HouseView> findFourHouseByType(int houseType) { return houseViewDao.findFourHouseByType(houseType); } @Override public HouseView findHouseByHouseId(int houseId) { return houseViewDao.findHouseByHouseId(houseId); } @Override public List<HouseView> findHouseByType(int currentPage, int houseType) { PageHelper.startPage(currentPage,5); return houseViewDao.findHouseByType(houseType); } @Override public void postHouse(House house) { houseViewDao.PostHouse(house); } @Override public void postHouseInfo(HouseInfo houseInfo) { houseViewDao.postHouseInfo(houseInfo); } @Override public void postHouseInter(HouseInter houseInter) { houseViewDao.postHouseInter(houseInter); }
}
UserServiceImpl package com.yiju.service.iml; import com.yiju.bean.UserAuth; import com.yiju.bean.UserInfo; import com.yiju.dao.IUserDao; import com.yiju.service.IUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class UserServiceImpl implements IUserService { @Autowired public IUserDao userDao; @Override public UserInfo findUserByPhone(String phone){ return userDao.findUserByPhone(phone); } @Override public void add(String phone, String password) { userDao.signup(phone,password); } @Override public void updateUserInfo(UserInfo userInfo) { userDao.updateUserInfo(userInfo); } @Override public UserAuth findUserAuth(int userId) { return userDao.findUserAuthByUserId(userId); } @Override public void postUserAuth(UserAuth userAuth) { userDao.postUserAuth(userAuth); } @Override public void deleteById(int userId) { userDao.deleteById(userId); } }
IHouseViewService
package com.yiju.service; import com.yiju.bean.House; import com.yiju.bean.HouseInfo; import com.yiju.bean.HouseInter; import com.yiju.pojo.HouseView; import java.util.List; public interface IHouseViewService { List<HouseView> findFourHouseByType(int houseType); HouseView findHouseByHouseId(int houseId); List<HouseView> findHouseByType(int currentPage, int houseType); void postHouse(House house); void postHouseInfo(HouseInfo houseInfo); void postHouseInter(HouseInter houseInter); }
IUserService
package com.yiju.service; import com.yiju.bean.UserAuth; import com.yiju.bean.UserInfo; public interface IUserService { UserInfo findUserByPhone(String phone); void add(String phone,String password); void updateUserInfo(UserInfo userInfo); UserAuth findUserAuth(int userId); void postUserAuth(UserAuth userAuth); void deleteById(int userId); }
yijuUtil
package com.yiju.util;
import com.qiniu.common.QiniuException; import com.qiniu.common.Zone; import com.qiniu.http.Response; import com.qiniu.storage.Configuration; import com.qiniu.storage.UploadManager; import com.qiniu.util.Auth; import java.text.SimpleDateFormat; import java.util.Date; import java.util.UUID; public class yijuUtil { public static void main(String[] args) { // String local="C:\\Users\\Administrator\\Desktop\\123.jpg"; // String upload="lyf.jpg"; String PicName = getPicName(); System.out.println(PicName); } public static String getPicName(){ SimpleDateFormat sf =new SimpleDateFormat("yyyyMMdd"); String picName =sf.format(new Date())+ UUID.randomUUID().toString(); return picName; } public static void upload( byte[] file,String upload){ final String AK="V86-ao-ntbpWZrtv7QF4YQ-8CM6sA_TSx1qB8Gyc"; final String SK="4C2-dUzRqQJ7-LEKR7ON4ey5GKVZw83QyGf4gWQE"; final String BUCKET="hualili1021"; Configuration cfg=new Configuration(Zone.zone1()) ; UploadManager uploadManager=new UploadManager(cfg); Auth auth=Auth.create(AK,SK); String uptake = auth.uploadToken(BUCKET); // File file=new File(local); try { Response response = uploadManager.put(file, upload, uptake); System.out.println(response); } catch (QiniuException e) { e.printStackTrace(); } } }
resoueces包文件如下
applicationContext.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<!-- 2.配置数据源 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="${jdbc.driver}"/> <property name="jdbcUrl" value="${jdbc.url}"/> <property name="user" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> <property name="maxPoolSize" value="30"/> <property name="minPoolSize" value="2"/> </bean> <!-- 3.配置SqlSessionFactory对象 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <!-- 注入数据库连接池 --> <property name="dataSource" ref="dataSource"/> <!-- 扫描bean包 使用别名 --> <property name="typeAliasesPackage" value="com.zhongruan.bean"></property> <!--配置加载映射文件 UserMapper.xml--> <property name="mapperLocations" value="classpath:mapper/*.xml"/> <property name="plugins"> <array> <bean class="com.github.pagehelper.PageInterceptor"> <property name="properties"> <props> <prop key="helperDialect">mysql</prop> <prop key="reasonable">true</prop> </props> </property> </bean> </array> </property> </bean> <!-- 自动生成dao,mapper--> <!-- 4.配置扫描Dao接口包,动态实现Dao接口,注入到spring容器中 --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <!-- 给出需要扫描Dao接口包 --> <property name="basePackage" value="com.zhongruan.dao"/> <!-- 注入sqlSessionFactory --> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> </bean> <!--自动扫描--> <context:component-scan base-package="com.zhongruan"/> <!-- 配置事务--> <!-- 5.配置事务管理器 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> <!-- 6.开启事务注解--> <tx:annotation-driven></tx:annotation-driven>
“`
db.properties
jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/zjgm jdbc.username=root jdbc.password=
Log4j.properties
# Global logging configuration log4j.rootLogger=DEBUG, stdout # Console output... log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
Housemapper1.xml
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="com.yiju.dao.IHouseViewDao"> <select id="findFourHouseByType" parameterType="int" resultType="com.yiju.pojo.HouseView"> SELECT * FROM tb_house a,tb_house_info b WHERE a.house_id=b.house_id AND a.is_delete=0 AND a.house_type=#{houseType} order by rand() limit 4; </select> <select id="findHouseByHouseId" parameterType="int" resultType="com.yiju.pojo.HouseView"> SELECT * FROM tb_house a,tb_house_info b WHERE a.house_id=b.house_id AND a.is_delete=0 AND a.house_id=#{houseId} </select> <select id="findHouseByType" parameterType="int" resultType="com.yiju.pojo.HouseView"> SELECT * FROM tb_house a,tb_house_info b WHERE a.house_id=b.house_id AND a.is_delete=0 AND a.house_type=#{houseType} </select> <insert id="PostHouse" parameterType="com.yiju.bean.House"> insert into tb_house(user_id, house_type, house_title, house_headimg, house_planimg1, house_planimg2, house_img1, house_img2, house_img3, house_img4, house_img5, house_img6, house_price, price_unit, house_address, is_delete, create_time, update_time) values (#{userId}, #{houseType}, #{houseTitle}, #{houseHeadimg}, #{housePlanimg1}, #{housePlanimg2}, #{houseImg1}, #{houseImg2}, #{houseImg3}, #{houseImg4}, #{houseImg5}, #{houseImg6}, #{housePrice}, #{priceUnit}, #{houseAddress}, #{isDelete}, #{createTime}, #{updateTime}) </insert> </mapper>
spring-mc-xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd"> <!-- 1.注解扫描位置--> <context:component-scan base-package="com.zhongruan.controller" /> <!-- 2.配置映射处理和适配器--> <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/> <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"/> <!-- 3.视图的解析器--> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> </bean> </beans>
index.jsp
<%--
Created by IntelliJ IDEA.
User: xcdn
Date: 2019/10/17
Time: 13:45
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<jsp:forward page="${pageContext.request.contextPath}/house/findFourHouse.do"></jsp:forward>
</body>
</html>
main.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>易居住房信息平台</title>
<!-- 下面是几个导入的包-->
<link type="text/css" href="css/css.css" rel="stylesheet"/>
<link type="text/css" href="css/searchInputStyle.css" rel="stylesheet"/>
<link type="text/css" href="css/searchReset.css" rel="stylesheet"/>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery2.min.js"></script>
<script type="text/javascript" src="js/js.js"></script>
<!-- 上面是几个导入的包-->
<%--轮播图的CSS--%>
<style>
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
#adv {
/*margin:110px auto;*/
width: 1190px;
position: relative;
}
#adv li {
display: none;
}
#adv .show {
display: block;
}
#next, #prev {
position: absolute;
top: 45%;
cursor: pointer;
transition: all .5s;
opacity: .7;
}
#next:hover, #prev:hover {
transform: scale(1.1);
opacity: 1;
}
#prev {
left: 10px;
height: 15%;
}
#next {
right: 10px;
height: 15%;
}
</style>
</head>
<body>
<jsp:include page="/pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="main.jsp"><img src="images/logo.png" width="163" height="59"/></a></h1>
</td>
<td>
<div class="searchbox">
<div class="mod_select">
<div class="select_box">
<span class="select_txt">房屋</span>
</div>
</div>
<%--FIXME 这里是搜索栏,需要实现相应的模糊搜索功能 --%>
<form action="#" >
<input type="text" name="house_title" id="searchPlaceholder" class="import" placeholder="请输入搜索信息">
<input type="submit" value="搜 索" class="btn-search">
</form>
</div>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏-->
<!--导航栏-->
<div class="list-nav">
<div class="width1190">
<ul class="nav">
<li><a href="main.jsp">首页</a></li>
<li><a href="#">新房</a></li>
<li><a href="#">二手房</a></li>
<li><a href="#">租房</a></li>
<li class="zhiding"><a href="#">指定购房</a></li>
<li><a href="${pageContext.request.contextPath}/pages/housePost1.jsp">发布房源</a><>
<li><a href="#">公告中心</a></li>
<li><a href="#">关于我们</a></li>
<div class="clears"></div>
</ul><!--nav-->
<div class="clears"></div>
</div><!--width1190-->
</div><!--list-nav-->
<!--导航栏End-->
<br>
<!--广告轮播栏-->
<div class="width1190">
<ul id="adv">
<li style="display: block;"><img src="images/lunbotu/fang1.jpg" alt="" id="pic"></li>
<img src="images/lunbotu/l.png" id="prev" alt="" onclick="showPre()">
<img src="images/lunbotu/r.png" id="next" alt="" onclick="showNext()">
</ul>
</div>
<%--广告轮播栏End --%>
<%--展示主页推荐栏--%>
<div class="content">
<div class="width1190">
<%--【新房推荐】--%>
<%--FIXME 这里添加跳转事件--%>
<h2 class="title"><a style="color:#F1323B">❤</a>新房推荐<a href="${pageContext.request.contextPath}/house/findHouse.do?houseType=0">更多>></a></h2>
<div class="index-fang-list">
<%--FIXME 这里使用Foreach循环,从数据库读取房屋信息 --%>
<c:forEach items="${newHouses}" var="nh">
<dl>
<dt><a href="${pageContext.request.contextPath}/house/findHouseById.do?houseId=${nh.houseId}"><img src="http://image.cxhit.com/${nh.houseHeadimg}" width="286"
height="188"/></a></dt>
<dd>
<h3><a href="#">${nh.houseTitle}</a></h3>
<div class="hui">${nh.houseLayout} | ${nh.houseArea} | ${nh.houseDecorate}</div>
</dd>
</dl>
</c:forEach>
<div class="clears"></div>
</div><!--index-fang-list/-->
<%----%>
<%--旧房推荐--%>
<h2 class="title"><a style="color:#F1323B">❤</a>二手房推荐 <a
href="${pageContext.request.contextPath}/house/findHouse.do?houseType=1">更多>></a></h2>
<div class="index-fang-list">
<c:forEach items="${oldHouses}" var="oh">
<dl>
<dt><a href="${pageContext.request.contextPath}/house/findHouseById.do?houseId=${oh.houseId}">
<img src="http://image.cxhit.com/${oh.houseHeadimg}" width="286" height="188"/></a></dt>
<dd>
<h3><a href="#">${oh.houseTitle}</a></h3>
<div class="hui">${oh.houseLayout} | ${oh.houseArea} | ${oh.houseDecorate}</div>
</dd>
</dl>
</c:forEach>
<div class="clears"></div>
</div><!--index-fang-list/-->
<%--【二手房推荐】--%>
<h2 class="title"><a style="color:#F1323B">❤</a>租房推荐 <a
href="#">更多>></a></h2>
<div class="index-ershou">
<%--左侧栏--%>
<div class="in-er-left">
<a href="#"><img src="images/fangt1.jpg" width="380" height="285"/></a>
<div class="in-er-left-text"><strong class="fl">闵行南方发的撒的发的司法</strong><strong
class="fr alignRight">¥2841</strong></div>
</div><!--in-er-left/-->
<%--右侧栏--%>
<div class="in-er-right">
<c:forEach items="${rentHouses}" var="rh">
<dl>
<dt><a href="${pageContext.request.contextPath}/house.do/fiindHouseById.do?houseId=${rh.houseId}"><img
src="http://image.cxhit.com/${rh.houseHeadimg}"
style="width: 150px; height: 115px;" width="150" height="115"/></a></dt>
<dd>
<h3>
<a href="${pageContext.request.contextPath}/house.do/fiindHouseById.do?houseId=${rh.houseId}">${rh.houseTitle}</a>
</h3>
<br>
<div class="in-er-right-text">
${rh.houseAddress}
</div>
<div class="price">¥<strong>${rh.housePrice}${rh.priceUnit}</strong></div>
</dd>
<div class="clears"></div>
</dl>
</c:forEach>
<div class="clears"></div>
</div><!--in-er-right/-->
<div class="clears"></div>
</div><!--index-ershou/-->
<%--【二手房推荐END】--%>
</div><!--width1190/-->
</div><!--content/-->
<!--这是页脚-->
<jsp:include page="pages/basefoot.jsp"></jsp:include>
</body>
</html>
basefoot.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>页脚</title>
<link type="text/css" href="../css/css.css" rel="stylesheet" />
</head>
<body>
<!--这是页脚-->
<div class="xinren">
<div class="width1190">
<table>
<tr>
<td>
<dl style="background:url(../images/icon1.jpg) left center no-repeat;">
<dt>承诺</dt>
<dd>真实可信100%真房源<br />链家承诺,假一赔百</dd>
</dl>
</td>
<td>
<dl style="background:url(../images/icon2.jpg) left center no-repeat;">
<dt>权威</dt>
<dd>独家房源 覆盖全城<br />房源信息最权威覆盖最广</dd>
</dl>
</td>
<td>
<dl style="background:url(../images/icon3.jpg) left center no-repeat;">
<dt>信赖</dt>
<dd>万名置业顾问 专业服务<br />百万家庭的信赖之选</dd>
</dl>
</td>
<td>
<dl style="background:url(../images/icon4.jpg) left center no-repeat;">
<dt>安全</dt>
<dd>安心承诺 保驾护航<br />多重风险防范机制 无后顾之忧</dd>
</dl>
</td>
</tr>
</table>
<div class="clears"></div>
</div><!--width1190/-->
</div><!--xinren/-->
<div class="footer">
<div class="width1190">
<!-- FIXME 这里把各个连接更换-->
<div class="fl"><a href="/index.jsp" target="_blank"><strong>易居平台</strong></a><a href="#">关于我们</a><a href="#">联系我们</a><a href="#" target="_blank">个人中心</a></div>
<div class="fr">
<dl>
<!-- FIXME 这里把图片更换-->
<dt><img src="../images/erweima.png" width="76" height="76" /></dt>
<dd>微信扫一扫<br />房价点评,精彩发布</dd>
</dl>
<dl>
<dt><img src="../images/erweima.png" width="76" height="76" /></dt>
<dd>微信扫一扫<br />房价点评,精彩发布</dd>
</dl>
<div class="clears"></div>
</div>
<div class="clears"></div>
</div><!--width1190/-->
</div><!--footer/-->
<div class="copy">Copyright@ 2019 易居住房交易平台 鄂ICP备19009914号-1 技术支持:<a target="_blank" href="#">中软国际</a> </div>
</body>
</html>
basehead.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>页头</title>
<!-- 下面是几个导入的包-->
<link type="text/css" href="../css/css.css" rel="stylesheet" />
<script type="text/javascript" src="../js/js.js"></script>
</head>
<body>
<!--头部最上方的框-->
<div class="header">
<div class="width1190">
<div class="fl" style="font-size: 14px">您好,欢迎来到<a href="../index.jsp">易居住房信息平台!</a></div>
<div class="fr">
<a href="#" style="font-size: 14px" target="_blank"><strong>登录</strong></a> |
<a href="#" style="font-size: 14px" target="_blank"><strong>注册</strong></a>
<a style="font-size: 14px">欢迎使用</a> |
<a href="#" style="font-size: 14px" target="_blank"><strong>个人中心</strong></a> |
<a href="#" style="font-size: 14px"><strong>退出</strong></a> |
<a href="javascript:;" onclick="" style="font-size: 14px">加入收藏</a> |
<a href="javascript:;" onclick="" style="font-size: 14px">设为首页</a>
</div>
<div class="clears"></div>
</div><!--width1190/-->
</div>
<!--头部最上方的框-->
</body>
</html>
details.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>房源详情页</title>
<%--导入CSS文件--%>
<link type="text/css" href="../css/css.css" rel="stylesheet" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Author" contect="http://www.webqin.net">
<link rel="shortcut icon" href="../images/favicon.ico" />
<scrip src="../js/jquery-2.1.1.min.js"></scrip>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/js.js"></script>
</head>
<body>
<!--头部最上方的框-->
<jsp:include page="${pageContext.request.contextPath}/pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<!--导航栏-->
<div class="list-nav">
<div class="width1190">
<ul class="nav">
<li><a href="../index.jsp">首页</a></li>
<li><a href="${pageContext.request.contextPath}/house/searchHouseViewByType.do?houseType=0¤tPage=1">新房</a></li>
<li><a href="${pageContext.request.contextPath}/house/searchHouseViewByType.do?houseType=1¤tPage=1">二手房</a></li>
<li><a href="${pageContext.request.contextPath}/house/searchHouseViewByType.do?houseType=2¤tPage=1">租房</a></li>
<li class="zhiding"><a href="#">指定购房</a></li>
<li><a href="${pageContext.request.contextPath}/pages/housePost1.jsp">发布房源</a></li>
<li><a href="#">公告中心</a></li>
<li><a href="#">关于我们</a></li>
<div class="clears"></div>
</ul><!--nav-->
<div class="clears"></div>
</div><!--width1190-->
</div><!--list-nav-->
<!--导航栏End-->
<div class="content">
<div class="width1190">
<p style="font-size: 16px">当前位置:<a href="../index.jsp">首页</a> >> <a href="/house/todetails.do?house_id=${houseInfo.houseId}">房源详情</a></p>
</div>
</div>
<%--显示房屋详情--%>
<div class="content">
<div class="width1190" style="width:1000px;">
<div class="proImg fl">
<img src="http://image.cxhit.com/${houseInfo.houseHeadimg}" />
</div><!--proImg/-->
<div style="width:535px;margin:30px 0;float: right;">
<h3 class="proTitle">${houseInfo.houseTitle} </h3>
<div class="proText1">
<table width="90%" align="left" cellspacing="5" cellpadding="5" style="font-size: 130%">
<tr>
<td>房屋编号:<a name="house_id">${houseInfo.houseId}</a></td>
<td>房屋性质:${houseInfo.houseNature}</td>
</tr>
<tr>
<td>装 修:${houseInfo.houseDecorate}</td>
<td>售 价:${houseInfo.housePrice}${houseInfo.priceUnit}</td>
</tr>
<tr>
<td>面 积:${houseInfo.houseArea}㎡</td>
<td>户 型:${houseInfo.houseLayout}</td>
</tr>
<tr>
<td>朝 向:${houseInfo.houseTurn}</td>
<td>配套电梯:
<c:choose>
<c:when test="${houseInfo.houseLift == 1}" >有</c:when>
<c:when test="${houseInfo.houseLift == 0}" >无</c:when>
<c:otherwise>未知</c:otherwise>
</c:choose>
</td>
</tr>
<tr>
<td>房屋类型:${houseInfo.houseModel}</td>
<td>楼 层:${houseInfo.houseFloor}层/${houseInfo.floorAll}层</td>
</tr>
<tr>
<td>建造年份:${houseInfo.houseYear}</td>
<td>居住期限:${houseInfo.houseValid} </td>
</tr>
<tr>
<td colspan="2">所在小区:${houseInfo.houseAddress}</td>
</tr>
<%--<tr><td colspan="2"> </td></tr>--%>
</table>
</div>
<div class="xun-car">
<input class="pricebutton" type="button" value="¥${houseInfo.housePrice}${houseInfo.priceUnit}">
<input class="collectbutton" type="button" value="关注房源">
<%--<a href="javascript:;" class="xwjg">¥<strong>${houseInfo.house_price}</strong>${houseInfo.price_unit}</a>--%>
<%--<a href="/user/follow.do?house_id=${houseInfo.house_id}" class="projrgwc">关注房源</a>--%>
</div>
</div><!--proText/-->
<div class="clears"></div>
</div><!--width1190/-->
<%--下面是房源详情页--%>
<div class="proBox" style="width:1000px;margin:10px auto;">
<div class="proEq">
<ul class="fl">
<li class="proEqCur">房源图片</li>
<li>小区介绍</li>
<li>用户评价</li>
</ul>
<div class="clears"></div>
</div><!--proEq/-->
<div class="proList">
<h2 class="title"><a style="color:#F1323B"> </a>房源平面图</h2>
<br>
<c:if test="${!empty houseInfo.housePlanimg1}">
<img src="http://image.cxhit.com/${houseInfo.housePlanimg1}" style="width: 286px;height: 188px"/>
</c:if>
<c:if test="${!empty houseInfo.housePlanimg2}">
<img src="http://image.cxhit.com/${houseInfo.housePlanimg2}" style="width: 286px;height: 188px"/>
</c:if>
<h2 class="title"><a style="color:#F1323B"> </a>房源内饰图</h2>
<br>
<c:if test="${!empty houseInfo.houseImg1}">
<img src="http://image.cxhit.com/${houseInfo.houseImg1}" style="width: 286px;height: 188px"/>
</c:if>
<c:if test="${!empty houseInfo.houseImg2}">
<img src="http://image.cxhit.com/${houseInfo.houseImg2}" style="width: 286px;height: 188px"/>
</c:if>
<c:if test="${!empty houseInfo.houseImg3}">
<img src="http://image.cxhit.com/${houseInfo.houseImg3}" style="width: 286px;height: 188px"/>
</c:if>
<c:if test="${!empty houseInfo.houseImg4}">
<img src="http://image.cxhit.com/${houseInfo.houseImg4}" style="width: 286px;height: 188px"/>
</c:if>
<c:if test="${!empty houseInfo.houseImg5}">
<img src="http://image.cxhit.com/${houseInfo.houseImg5}" style="width: 286px;height: 188px"/>
</c:if>
<c:if test="${!empty houseInfo.houseImg6}">
<img src="http://image.cxhit.com/${houseInfo.houseImg6}" style="width: 286px;height: 188px"/>
</c:if>
</div><!--proList/-->
<div class="proList">
暂无信息...
</div>
<div class="proList">
暂无评论……
</div>
<!--proList/-->
</div><!--proBox/-->
</div><!--content/-->
<%--引入页脚--%>
<iframe src="../pages/basefoot.jsp"frameborder="0" scrolling="no" height="263px" width="100%"></iframe>
</body>
</html>
newhouse.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ page import="java.util.List" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %><%--
Created by IntelliJ IDEA.
User: 36353
Date: 2019-07-04
Time: 22:54
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
<title>新房房源列表</title>
<%--导入CSS文件--%>
<link type="text/css" href="../css/css.css" rel="stylesheet"/>
<%--导航栏的JS--%>
<script type="text/javascript" src="../js/js.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
<%--搜索框的css--%>
<link type="text/css" href="../css/searchInputStyle.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchReset.css" rel="stylesheet"/>
<script type="text/javascript" src="js/jquery2.min.js"></script>
</head>
<body>
<!--头部最上方的框-->
<jsp:include page="../pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59"/></a>
</h1>
</td>
<td align="center">
<div class="phones"><strong>000-0000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏-->
<!--导航栏-->
<div class="list-nav">
<div class="width1190">
<ul class="nav">
<li><a href="#">首页</a></li>
<li><a href="#">新房</a></li>
<li><a href="#">二手房</a></li>
<li><a href="#">租房</a></li>
<li class="zhiding"><a href="#">指定购房</a></li>
<li><a href="#">发布房源</a></li>
<li><a href="#">公告中心</a></li>
<li><a href="#">关于我们</a></li>
<div class="clears"></div>
</ul><!--nav-->
<div class="clears"></div>
</div><!--width1190-->
</div><!--list-nav-->
<!--导航栏End-->
<!--Logo栏和手机号栏-->
<hr width="1280px">
<%--<div class="content">--%>
<div class="width1190">
<p style="font-size: 16px">当前位置:<a href="../index.jsp">首页</a> >> <a
href="#">新房房源</a></p>
</div>
<%--</div>--%>
<%--房源列表--%>
<div class="content">
<div class="width1190">
<form action="" method="get" class="pro-search">
<div class="paixu">
<strong>排序:</strong>
<a href="javascript:;" class="pai-cur">默认</a>
<a href="javascript:;">价格 ∨</a>
<a href="javascript:;">最新 ∨</a>
</div>
</form><!--pro-search/-->
</div><!--width1190/-->
<div class="width1190">
<div class="pro-left">
<%--房屋信息分页显示--%>
<c:forEach var="house" items="${pageInfo.list}">
<dl>
<dt><a href="${pageContext.request.contextPath}/house/todetails.do?houseId=${house.houseId}"><img
src="http://image.cxhit.com/${house.houseHeadimg}" style="width:286px;height:188px"
width="286" height="188"/></a></dt>
<dd>
<h3><a href="${pageContext.request.contextPath}/house/todetails.do?houseId=${house.houseId}">${house.houseTitle}</a></h3>
<div class="pro-wei">
<img src="../images/weizhi.png" width="12" height="16" style="width:12px;height:16px"/>
<strong class="red">${house.houseAddress}</strong>
</div>
<div class="pro-fang">${house.houseLayout} ${house.houseArea}平 ${house.houseTurn} ${house.houseFloor}层/${house.floorAll}层</div>
<div class="pra-fa">发布人:${house.trueName}先生 发布时间:${house.date}</div>
</dd>
<div class="price">¥ <strong>${house.housePrice}</strong><span
class="font12">${house.priceUnit}</span></div>
<div class="clears"></div>
</dl>
</c:forEach>
<%--分页按钮--%>
<div class="pull-right">
<ul class="pagination">
<li>
<a href="${pageContext.request.contextPath}/house/findHouse.do?houseq1Type=0¤tPage=1"
aria-label="Previous">首页</a>
</li>
<li>
<a href=" ${pageContext.request.contextPath}/house/findHouse.do?houseType=0¤tPage=${pageInfo.pageNum-1}">上一页</a>
</li>
<c:forEach begin="1" end="${pageInfo.pages}" step="1" var="i">
<li>
<a href="${pageContext.request.contextPath}/house/findHouse.do?houseType=0¤tPage=${i}">${i}</a>
</li>
</c:forEach>
<li>
<a href="${pageContext.request.contextPath}/house/findHouse.do?houseType=0¤tPage=${pageInfo.pageNum+1}">下一页</a>
</li>
<li>
<a href="${pageContext.request.contextPath}/house/findHouse.do?houseType=0¤tPage=${pageInfo.pages}" aria-label="Next">尾页</a>
</li>
</ul>
</div><!--底部分页栏-->
</div><!--pro-left/-->
<div class="pro-right">
<h2 class="right-title">推荐房源</h2>
<div class="right-pro">
<c:forEach var="randomHouse" items="${fh}">
<dl>
<dt>
<a href="#"><img
src="http://image.cxhit.com/${randomHouse.houseHeadimg}"
style="width: 135px; height: 88px"/></a></dt>
<dd>
<h3>
<a href="#">${randomHouse.houseTitle}</a>
</h3>
<div class="pro-fang">${randomHouse.houseLayout} ${randomHouse.houseArea}平
朝${randomHouse.houseTurn}</div>
<div class="right-price">${randomHouse.housePrice}${randomHouse.priceUnit}</div>
</dd>
</dl>
</c:forEach>
</div><!--right-pro/-->
</div><!--pro-right/-->
<div class="clears"></div>
</div><!--width1190/-->
</div><!--content/-->
<%--显示页脚--%>
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
</body>
</html>
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <!-- 配置加载类路径的配置文件 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:applicationContext.xml</param-value> </context-param> <!-- 配置监听器 --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> </listener> <!-- 解决中文乱码过滤器 --> <filter> <filter-name>characterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>characterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- 前端控制器(加载classpath:spring-mvc.xml 服务器启动创建servlet) --> <servlet> <servlet-name>dispatcherServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <!-- 配置初始化参数,创建完DispatcherServlet对象,加载springmvc.xml配置文件 --> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring-mvc.xml</param-value> </init-param> <!-- 服务器启动的时候,让DispatcherServlet对象创建 --> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcherServlet</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> </web-app>
HouseMapper.xml
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="com.yiju.dao.IHouseViewDao"> <select id="findFourHouseByType" parameterType="int" resultType="com.yiju.pojo.HouseView"> SELECT * FROM tb_house a,tb_house_info b WHERE a.house_id=b.house_id AND a.is_delete=0 AND a.house_type=#{houseType} order by rand() limit 4; </select> <select id="findHouseByHouseId" parameterType="int" resultType="com.yiju.pojo.HouseView"> SELECT * FROM tb_house a,tb_house_info b WHERE a.house_id=b.house_id AND a.is_delete=0 AND a.house_id=#{houseId} </select> <select id="findHouseByType" parameterType="int" resultType="com.yiju.pojo.HouseView"> SELECT * FROM tb_house a,tb_house_info b WHERE a.house_id=b.house_id AND a.is_delete=0 AND a.house_type=#{houseType} </select> <insert id="PostHouse" parameterType="com.yiju.bean.House"> insert into tb_house(user_id, house_type, house_title, house_headimg, house_planimg1, house_planimg2, house_img1, house_img2, house_img3, house_img4, house_img5, house_img6, house_price, price_unit, house_address, is_delete, create_time, update_time) values ("10005", #{houseType}, #{houseTitle}, #{houseHeadimg}, #{housePlanimg1}, #{housePlanimg2}, #{houseImg1}, #{houseImg2}, #{houseImg3}, #{houseImg4}, #{houseImg5}, #{houseImg6}, #{housePrice}, #{priceUnit}, #{houseAddress}, #{isDelete}, #{createTime}, #{updateTime}) </insert> <insert id="postHouseInfo" parameterType="com.yiju.bean.HouseInfo"> insert into tb_house_info(house_id, house_nature, house_model, house_year, house_valid, house_layout, house_area, house_turn, house_floor, floor_all, house_decorate, house_lift, create_time, update_time) values (#{houseId}, #{houseNature}, #{houseModel}, #{houseYear}, #{houseValid}, #{houseLayout}, #{houseArea}, #{houseTurn}, #{houseFloor}, #{floorAll}, #{houseDecorate}, #{houseLift}, #{createTime}, #{updateTime}) </insert> </mapper>
housePost1.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>发布房源信息</title>
<!-- 下面是几个导入的包-->
<link type="text/css" href="../css/css.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchInputStyle.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchReset.css" rel="stylesheet"/>
<link rel="stylesheet" href="../css/houseSend.css"/>
<script type="text/javascript" src="../js/js.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<body>
<!--头部最上方的框-->
<jsp:include page="${pageContext.request.contextPath}/pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<!--导航栏-->
<div class="list-nav">
<div class="width1190">
<ul class="nav">
<li><a href="index.jsp">首页</a></li>
<li><a href="#">新房</a></li>
<li><a href="#">二手房</a></li>
<li><a href="#">租房</a></li>
<li class="zhiding"><a href="#">指定购房</a></li>
<li><a href="${pageContext.request.contextPath}/pages/housePost1.jsp">发布房源</a></li>
<li><a href="#">公告中心</a></li>
<li><a href="#">关于我们</a></li>
<div class="clears"></div>
</ul><!--nav-->
<div class="clears"></div>
</div><!--width1190-->
</div><!--list-nav-->
<!--导航栏End-->
<%--信息填写栏--%>
<div class="width1190">
<br/>
<h4 style="font-size:16px; text-align:center; font-weight:bold;">房源基本信息填写</h4>
<br/>
<!--中心-->
<div class="content">
<div class="register-box">
<div class="wrap">
<div class="register-box-con2">
<form action="${pageContext.request.contextPath}/house/toHousePost2.do" method="post" enctype="multipart/form-data">
<!--房源标题-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源标题</label>
<div class="register-box-con2-box-right">
<input type="text" name="houseTitle" class="login-box-cen-form-input w358"
placeholder="请输入您的房源帖子标题" id="reg_info_company"/>
<!-- <label id="reg_info_company_text" class="err err-top40">请输入与工商营业执照一致的公司名称,不超过20个字</label>-->
</div>
</div>
<!--房源地址-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源地址</label>
<div class="register-box-con2-box-right">
<input type="text" name="houseAddress" class="login-box-cen-form-input w358"
placeholder="请输入您的房源详细地址" id="reg_info_www"/>
<!-- <label class="err err-top40" id="reg_info_www_text">请输入正确的网址</label>-->
</div>
</div>
<!--预期售价-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>期望售价</label>
<div class="register-box-con2-box-right">
<input type="text" name="housePrice" class="login-box-cen-form-input w180"
placeholder="请输入期望售价" id="reg_info_address"/>
<!-- <label class="err err-top40" id="reg_info_address_text">公司所在地址,不超过40个字</label>-->
<div id="parent">
<select name="price_unit">
<option>元/套</option>
<option>元/月</option>
<option>元/年</option>
</select>
</div>
</div>
</div>
<!--FIXME 房源头像图-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian"></em>房源头像图</label>
<div class="register-box-con2-box-right">
<label class="register-box-con2-box-upload">
<input type="file" name="houseHeadimg" id="headimg"/>
<div class="register-box-con2-box-upload-ti">
<em id="headimg_w">点击上传</em>
<img id="headimg_base64" style="display:none;"/>
</div>
</label>
<label class="err err-top160" id="headimgText">支持图片格式JPG/PNG,图片大小不超过2M</label>
</div>
</div>
<!--FIXME 房源平面图-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left">
<em class="bitian">
</em>房源平面图</label>
<div class="register-box-con2-box-right">
<!--第一张图片-->
<label class="register-box-con2-box-upload1">
<input type="file" name="housePlanimg1" id="planimg1"/>
<div class="register-box-con2-box-upload-ti1">
<em id="planimg1_w">上传</em>
<img id="planimg1_base64" style="display:none;"/></div>
</label>
<!--第二张图片-->
<label class="register-box-con2-box-upload1" style=" margin-left: 10px;">
<input type="file" name="housePlanimg2" id="planimg2"/>
<div class="register-box-con2-box-upload-ti1">
<em id="planimg2_w">上传</em>
<img id="planimg2_base64" style="display:none;"/></div>
</label>
<label class="err err-top160" id="planimg1Text">支持图片格式JPG/PNG,图片大小不超过2M</label>
</div>
</div>
<!--FIXME 房源室内图-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left">
<em class="bitian"></em>房源室内图
</label>
<div class="register-box-con2-box-right">
<!--第一张图片-->
<label class="register-box-con2-box-upload2">
<input type="file" name="houseImg1" id="inter1"/>
<div class="register-box-con2-box-upload-ti2"><em id="inter1_w">上传</em><img
id="inter1_base64" style="display:none;"/></div>
</label>
<!--第二章图片-->
<label class="register-box-con2-box-upload2" style=" margin-left: 10px;">
<input type="file" name="houseImg2" id="inter2"/>
<div class="register-box-con2-box-upload-ti2"><em id="inter2_w">上传</em><img
id="inter2_base64" style="display:none;"/></div>
</label>
<!--第三张图片-->
<label class="register-box-con2-box-upload2" style=" margin-left: 10px;">
<input type="file" name="houseImg3" id="inter3"/>
<div class="register-box-con2-box-upload-ti2"><em id="inter3_w">上传</em><img
id="inter3_base64" style="display:none;"/></div>
</label>
<label class="err err-top160" id="inter2_text">支持图片格式JPG/PNG,图片大小不超过2M</label>
</div>
</div>
<!--第二行图片-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian"></em></label>
<div class="register-box-con2-box-right">
<!--第四张图片-->
<label class="register-box-con2-box-upload2">
<input type="file" name="houseImg4" id="inter4"/>
<div class="register-box-con2-box-upload-ti2"><em id="inter4_w">上传</em><img
id="inter4_base64" style="display:none;"/></div>
</label>
<!--第五张图片-->
<label class="register-box-con2-box-upload2" style=" margin-left: 10px;">
<input type="file" name="houseImg5" id="inter5"/>
<div class="register-box-con2-box-upload-ti2">
<em id="inter5_w">上传</em>
<img id="inter5_base64" style="display:none;"/>
</div>
</label>
<!--第六章图片-->
<label class="register-box-con2-box-upload2" style=" margin-left: 10px;">
<input type="file" name="houseImg6" id="inter6"/>
<div class="register-box-con2-box-upload-ti2">
<em id="inter6_w">上传</em>
<img id="inter6_base64" style="display:none;"/></div>
</label>
<label class="err err-top160" id="inter3_text">支持图片格式JPG/PNG,图片大小不超过2M</label>
</div>
</div>
<!--End 房源室内图-->
<div class="register-box-con2-box clearfix mar-bottom20 mar-top50">
<label class="register-box-con2-box-left"></label>
<div class="register-box-con2-box-right">
<input type="submit" value="下一步" class="login-box-cen-form-button" style="width: 360px"
id="reg_info_submit"/>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<br/><br/>
</div>
<script type="text/javascript" src="../js/jqueryhouse.min.js"></script>
<script type="text/javascript" src="../js/tbdValidate.js"></script>
<script type="text/javascript" src="../js/upload.js"></script>
<script src="../js/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
//图片预览路径
function getObjectURL(file) {
var url = null;
if (window.createObjectURL != undefined) { // basic
url = window.createObjectURL(file);
} else if (window.URL != undefined) { // mozilla(firefox)
url = window.URL.createObjectURL(file);
} else if (window.webkitURL != undefined) { // webkit or chrome
url = window.webkitURL.createObjectURL(file);
}
return url;
}
</script>
<!--这是页脚-->
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
<br>
</body>
</html>
housePost2
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>发布房源信息</title>
<!-- 下面是几个导入的包-->
<link type="text/css" href="../css/css.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchInputStyle.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchReset.css" rel="stylesheet"/>
<link rel="stylesheet" href="../css/houseSend.css"/>
<script type="text/javascript" src="../js/js.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<body>
<!--头部最上方的框-->
<jsp:include page="${pageContext.request.contextPath}/pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<!--导航栏-->
<div class="list-nav">
<div class="width1190">
<ul class="nav">
<li><a href="index.jsp">首页</a></li>
<li><a href="#">新房</a></li>
<li><a href="#">二手房</a></li>
<li><a href="#">租房</a></li>
<li class="zhiding"><a href="#">指定购房</a></li>
<li><a href="${pageContext.request.contextPath}/pages/housePost1.jsp">发布房源</a></li>
<li><a href="#">公告中心</a></li>
<li><a href="#">关于我们</a></li>
<div class="clears"></div>
</ul><!--nav-->
<div class="clears"></div>
</div><!--width1190-->
</div><!--list-nav-->
<!--导航栏End-->
<%--信息填写栏--%>
<div class="width1190">
<br/>
<h4 style="font-size:16px; text-align:center; font-weight:bold;">房源详细信息填写</h4>
<br/>
<!--中心-->
<div class="content">
<div class="register-box">
<div class="wrap">
<div class="register-box-con2">
<!--房源性质-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源性质</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseNature"
placeholder="如:商品房、住宅房等" id="house_natuer"/>
</div>
</div>
<!--房源类型-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源类型</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseModel"
placeholder="如:普通住宅、公寓式住宅、别墅等" id="house_model"/>
</div>
</div>
<!--房源建造年-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源建造年</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseYear"
placeholder="如:2008、2019等" id="house_year"/>
</div>
</div>
<!--房源期限-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源期限</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseValid"
placeholder="如:70年、80年、永久等" id="house_valid"/>
</div>
</div>
<!--房源户型-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源户型</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseLayout"
placeholder="如:2厅4室2卫等" id="house_layout"/>
</div>
</div>
<!--房源面积-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源面积</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseArea"
placeholder="如:100、85等。单位:m²" id="house_narea"/>
</div>
</div>
<!--房源朝向-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源朝向</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseTurn"
placeholder="如:南北、西南等" id="house_turn"/>
</div>
</div>
<!--房源楼层-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源楼层</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseFloor"
placeholder="如:6、8、9等" id="house_floor"/>
</div>
</div>
<!--总楼层-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>总楼层</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="floorAll"
placeholder="如:7、13、16等" id="floor_all"/>
</div>
</div>
<!--装修类型-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>装修类型</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseDecorate"
placeholder="如:精装修、简装修等" id="house_decorate"/>
</div>
</div>
<!--是否有电梯-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>是否有电梯</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseLift"
placeholder="如:是、否等" id="house_lift"/>
</div>
</div>
<div class="register-box-con2-box clearfix mar-bottom20 mar-top50" align="center">
<label class="register-box-con2-box-left"></label>
<div class="register-box-con2-box-right" align="center">
<input type="button" value="下一步" class="login-box-cen-form-button w180" id="next_submit"/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="../js/jqueryhouse.min.js"></script>
<script type="text/javascript" src="../js/tbdValidate.js"></script>
<script type="text/javascript" src="../js/upload.js"></script>
<script src="../js/jquery-2.1.1.min.js"></script>
<!--这是页脚-->
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
<script type="text/javascript">
$(function () {
$("#next_submit").on("click",function () {
var houseNature = $("input[name=houseNature]").val();
var houseModel = $("input[name=houseModel]").val();
var houseYear = $("input[name=houseYear]").val();
var houseValid = $("input[name=houseValid]").val();
var houseLayout = $("input[name=houseLayout]").val();
var houseArea = $("input[name=houseArea]").val();
var houseTurn = $("input[name=houseTurn]").val();
var houseFloor = $("input[name=houseFloor]").val();
var floorAll = $("input[name=floorAll]").val();
var houseDecorate = $("input[name=houseDecorate]").val();
var houseLift;
if ($("input[name=houseLift]").val() == "是") {
houseLift = 1;
} else {
houseLift = 0;
}
//校验信息
if (houseNature == "") {
alert("请输入房源性质!");
return;
}
else if (houseModel == "") {
alert("请输入房源类型!");
return;
}
else if (houseYear == "") {
alert("请输入建造时间!");
return;
}
else if (houseValid == "") {
alert("请输入房源期限!");
return;
}
else if (houseLayout == "") {
alert("请输入房源户型!");
return;
}
else if (houseArea == "") {
alert("请输入房源面积!");
return;
}
else if (houseTurn == "") {
alert("请输入朝向!");
return;
}
else if (houseFloor == "") {
alert("请输入楼层!");
return;
}
else if (floorAll == "") {
alert("请输入预售价格!");
return;
}
else if (houseDecorate == "") {
alert("请输入装饰类型!");
return;
} else if (houseLift == "") {
alert("请说明有无电梯!");
return;
}else {
$.ajax({
url:"${pageContext.request.contextPath}/house/responsePost2.do",
type:"post",
dataType:"json",
data:{
houseNature:houseNature,
houseMosel:houseModel,
houseYear:houseYear,
houseValid:houseValid,
houseLayout:houseLayout,
houseArea: houseArea,
houseTurn:houseTurn,
houseFloor:houseFloor,
floorAll:floorAll,
houseDecorate:houseDecorate,
houseLift:houseLift
},
success:function () {
window.location.href="${pageContext.request.contextPath}/pages/housePost3.jsp"
}
})
}
});
})
获取几个基本信息
</script>
</html>
housePost3
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>发布房源信息</title>
<!--下面是几个导入的包-->
<link rel="stylesheet" href="../css/houseCheckStyle.css"/>
<link type="text/css" href="../css/css.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchInputStyle.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchReset.css" rel="stylesheet"/>
<link rel="stylesheet" href="../css/houseSend.css"/>
<script type="text/javascript" src="../js/js.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<body>
<!--头部最上方的框-->
<jsp:include page="${pageContext.request.contextPath}/pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<!--导航栏-->
<div class="list-nav">
<div class="width1190">
<ul class="nav">
<li><a href="index.jsp">首页</a></li>
<li><a href="${pageContext.request.contextPath}/house/searchHouseViewByType.do?houseType=0¤tPage=1">新房</a></li>
<li><a href="${pageContext.request.contextPath}/house/searchHouseViewByType.do?houseType=1¤tPage=1">二手房</a></li>
<li><a href="${pageContext.request.contextPath}/house/searchHouseViewByType.do?houseType=2¤tPage=1">租房</a></li>
<li class="zhiding"><a href="#">指定购房</a></li>
<li><a href="${pageContext.request.contextPath}/pages/housePost1.jsp">发布房源</a></li>
<li><a href="#">公告中心</a></li>
<li><a href="#">关于我们</a></li>
<div class="clears"></div>
</ul><!--nav-->
<div class="clears"></div>
</div><!--width1190-->
</div><!--list-nav-->
<!--导航栏End-->
<%--信息填写栏--%>
<div class="width1190" align="center">
<br/>
<h4 style="font-size:16px; text-align:center; font-weight:bold;">房源内饰信息填写</h4>
<br/>
<div align="center">
<table align="cenetr">
<tr>
<td>
<ul class="tg-list">
<li class="tg-list-item">
<h4>床</h4>
<input class="tgl tgl-flip" id="bed" type="checkbox" onclick="bedClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="bed"></label>
</li>
<li class="tg-list-item">
<h4>洗衣机</h4>
<input class="tgl tgl-flip" id="washing" type="checkbox" onclick="washingClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="washing"></label>
</li>
<li class="tg-list-item">
<h4>空调</h4>
<input class="tgl tgl-flip" id="air" type="checkbox" onclick="airClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="air"></label>
</li>
<li class="tg-list-item">
<h4>阳台</h4>
<input class="tgl tgl-flip" id="balcony" type="checkbox" onclick="balconyClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="balcony"></label>
</li>
<li class="tg-list-item">
<h4>冰箱</h4>
<input class="tgl tgl-flip" id="ice" type="checkbox" onclick="iceClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="ice"></label>
</li>
<li class="tg-list-item">
<h4>卫生间</h4>
<input class="tgl tgl-flip" id="toilet" type="checkbox" onclick="toiletClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="toilet"></label>
</li>
<li class="tg-list-item">
<h4>厨房</h4>
<input class="tgl tgl-flip" id="kitchen" type="checkbox" onclick="kitchenClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="kitchen"></label>
</li>
</ul>
</td>
</tr>
<tr align="center">
<td style="align-content: center">
<ul class="tg-list">
<li class="tg-list-item">
<h4>电视</h4>
<input class="tgl tgl-flip" id="tv" type="checkbox" onclick="tvClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="tv"></label>
</li>
<li class="tg-list-item">
<h4>热水器</h4>
<input class="tgl tgl-flip" id="heater" type="checkbox" onclick="heaterClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="heater"></label>
</li>
<li class="tg-list-item">
<h4>衣柜</h4>
<input class="tgl tgl-flip" id="wardrobe" type="checkbox" onclick="wardrobeClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="wardrobe"></label>
</li>
<li class="tg-list-item">
<h4>暖气</h4>
<input class="tgl tgl-flip" id="heating" type="checkbox" onclick="heatingClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="heating"></label>
</li>
<li class="tg-list-item">
<h4>宽带</h4>
<input class="tgl tgl-flip" id="internet" type="checkbox" onclick="internetClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="internet"></label>
</li>
<li class="tg-list-item">
<h4>沙发</h4>
<input class="tgl tgl-flip" id="sofa" type="checkbox" name="sofa" onclick="sofaClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="sofa" id="sofal"></label>
</li>
</ul>
</td>
</tr>
</table>
</div>
<%--下一步按钮--%>
<div align="cneter">
<div align="center">
<div class="register-box-con2-box clearfix mar-bottom20 mar-top50" align="center">
<label class="register-box-con2-box-left" style="width: 500px"></label>
<div class="register-box-con2-box-right" align="center">
<input type="submit" value="提交" class="login-box-cen-form-button w180" id="next_submit"
align="center"/>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="../js/jqueryhouse.min.js"></script>
<script type="text/javascript" src="../js/tbdValidate.js"></script>
<script type="text/javascript" src="../js/upload.js"></script>
<script src="../js/jquery-2.1.1.min.js"></script>
<!--这是页脚-->
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
</body>
</html>
UserinfoMapper.xml
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="com.yiju.dao.IUserDao"> <select id="findUserByPhone" parameterType="String" resultType="com.yiju.bean.UserInfo"> select * from tb_user where phone=#{phone} </select> <select id="signup" parameterType="String"> insert into tb_user (phone,password) values (#{phone},#{password}) </select> <update id="updateUserInfo" parameterType="com.yiju.bean.UserInfo"> update tb_user set truename=#{truename},nickname=#{nickname},gender=#{gender},city=#{city} where user_id=#{userId} </update> <select id="findUserAuthByUserId" parameterType="int" resultType="com.yiju.bean.UserAuth"> select * from tb_user_auth where user_Id=#{userId} </select> <insert id="postUserAuth" parameterType="com.yiju.bean.UserAuth"> insert into tb_user_auth(user_id,user_name,user_gender,user_card,user_card_address,user_live_address,create_time,update_time) value(#{userId},#{userName},#{userGender},#{userCard},#{userCardAddress},#{userLiveAddress}, #{createTime},#{updateTime}) </insert> <delete id="deleteById" parameterType="int"> delete from tb_user_auth where user_id=#{userId} </delete> </mapper>
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd"> <!-- 1.配置数据库相关参数properties的属性:${url} --> <context:property-placeholder location="classpath:db.properties"/> <!-- 2.配置数据源 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="${jdbc.driver}"/> <property name="jdbcUrl" value="${jdbc.url}"/> <property name="user" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> <property name="maxPoolSize" value="30"/> <property name="minPoolSize" value="2"/> </bean> <!-- 3.配置SqlSessionFactory对象 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <!-- 注入数据库连接池 --> <property name="dataSource" ref="dataSource"/> <!-- 扫描bean包 使用别名 --> <property name="typeAliasesPackage" value="com.yiju.bean"></property> <!--配置加载映射文件 UserMapper.xml--> <property name="mapperLocations" value="classpath:mapper/*.xml"/> <!--加载分页插件--> <property name="plugins"> <array> <bean class="com.github.pagehelper.PageInterceptor"> <property name="properties"> <props> <prop key="helperDialect">mysql</prop> <prop key="reasonable">true</prop> </props> </property> </bean> </array> </property> <property name="configuration"> <bean class="org.apache.ibatis.session.Configuration"> <!--可以加入驼峰命名法其他mybatis的配置也就是mybatis.cfg.xml的相关配置都会转移到这里--> <property name="mapUnderscoreToCamelCase" value="true"/> </bean> </property> </bean> <!-- 自动生成dao,mapper--> <!-- 4.配置扫描Dao接口包,动态实现Dao接口,注入到spring容器中 --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <!-- 给出需要扫描Dao接口包 --> <property name="basePackage" value="com.yiju.dao"/> <!-- 注入sqlSessionFactory --> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> </bean> <!--自动扫描--> <context:component-scan base-package="com.yiju"/> <!-- 配置事务--> <!-- 5.配置事务管理器 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> <!-- 6.开启事务注解--> <tx:annotation-driven></tx:annotation-driven> </beans>
db.properties
#以下内容根据自己来配置 jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/yiju?useSSL=true&characterEncoding=utf-8 jdbc.username=root jdbc.password=
log4j.properties
# Global logging configuration log4j.rootLogger=DEBUG, stdout # Console output... log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
spring-mvc.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd"> <!-- 1.注解扫描位置--> <context:component-scan base-package="com.yiju.controller" /> <!-- 2.配置映射处理和适配器--> <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/> <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"/> <!-- 3.视图的解析器--> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/pages/" /> <property name="suffix" value=".jsp" /> </bean> <!-- 4.配置文件上传配置 --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <!-- 配置文件上传编码 --> <property name="defaultEncoding" value="utf-8"/> <!-- 配置文件上传大小 --> <property name="maxUploadSize" value=""/> </bean> </beans>
pom.xml包
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.zhongruan</groupId>
<artifactId>yj</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>yj Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- spring版本号 -->
<spring.version>5.0.2.RELEASE</spring.version>
<!-- mybatis版本号 -->
<mybatis.version>3.2.6</mybatis.version>
<!-- log4j日志文件管理包版本 -->
<slf4j.version>1.7.7</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<c3p0.version>0.9.5.2</c3p0.version>
<taglibs.version>1.1.2</taglibs.version>
</properties>
<dependencies>
<!-- spring核心包 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- mybatis核心包 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<!-- mybatis/spring包 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.1</version>
</dependency>
<!-- 导入java ee jar 包 -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<!-- 导入Mysql数据库链接jar包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.30</version>
</dependency>
<!-- 导入dbcp的jar包,用来在applicationContext.xml中配置数据库 -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<!-- JSTL标签类 -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- 日志文件管理包 -->
<!-- log start -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- 数据连接池 -->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>${c3p0.version}</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>${taglibs.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- 导入servlet-api/jsp -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<!--PageHelper-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
</dependency>
<!-- 上传文件 -->
<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.2</version>
</dependency>
<!--七牛云-->
<dependency>
<groupId>com.qiniu</groupId>
<artifactId>qiniu-java-sdk</artifactId>
<version>7.2.24</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.0.2.RELEASE</version>
<scope>compile</scope>
</dependency>
<!--PageHelper-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.2.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.0.2.RELEASE</version>
<scope>compile</scope>
</dependency>
<!--阿里云短信验证码SDK-->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>6.1.25</version>
</dependency>
<!--阿里云-->
<!-- JSONObject对象依赖的jar包 -->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.2.3</version>
<classifier>jdk15</classifier><!-- 指定jdk版本 -->
</dependency>
<dependency>
<groupId>com.qiniu</groupId>
<artifactId>qiniu-java-sdk</artifactId>
<version>7.2.24</version>
</dependency>
<!-- Json依赖架包下载 -->
</dependencies>
<build>
<finalName>yj</finalName>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
housePost1.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>发布房源信息</title>
<!-- 下面是几个导入的包-->
<link type="text/css" href="../css/css.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchInputStyle.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchReset.css" rel="stylesheet"/>
<link rel="stylesheet" href="../css/houseSend.css"/>
<script type="text/javascript" src="../js/js.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<body>
<!--头部最上方的框-->
<jsp:include page="${pageContext.request.contextPath}/pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<!--导航栏-->
<div class="list-nav">
<div class="width1190">
<ul class="nav">
<li><a href="index.jsp">首页</a></li>
<li><a href="#">新房</a></li>
<li><a href="#">二手房</a></li>
<li><a href="#">租房</a></li>
<li class="zhiding"><a href="#">指定购房</a></li>
<li><a href="${pageContext.request.contextPath}/pages/housePost1.jsp">发布房源</a></li>
<li><a href="#">公告中心</a></li>
<li><a href="#">关于我们</a></li>
<div class="clears"></div>
</ul><!--nav-->
<div class="clears"></div>
</div><!--width1190-->
</div><!--list-nav-->
<!--导航栏End-->
<%--信息填写栏--%>
<div class="width1190">
<br/>
<h4 style="font-size:16px; text-align:center; font-weight:bold;">房源基本信息填写</h4>
<br/>
<!--中心-->
<div class="content">
<div class="register-box">
<div class="wrap">
<div class="register-box-con2">
<form action="${pageContext.request.contextPath}/house/toHousePost2.do" method="post" enctype="multipart/form-data">
<!--房源标题-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源标题</label>
<div class="register-box-con2-box-right">
<input type="text" name="houseTitle" class="login-box-cen-form-input w358"
placeholder="请输入您的房源帖子标题" id="reg_info_company"/>
<!-- <label id="reg_info_company_text" class="err err-top40">请输入与工商营业执照一致的公司名称,不超过20个字</label>-->
</div>
</div>
<!--房源地址-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源地址</label>
<div class="register-box-con2-box-right">
<input type="text" name="houseAddress" class="login-box-cen-form-input w358"
placeholder="请输入您的房源详细地址" id="reg_info_www"/>
<!-- <label class="err err-top40" id="reg_info_www_text">请输入正确的网址</label>-->
</div>
</div>
<!--预期售价-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>期望售价</label>
<div class="register-box-con2-box-right">
<input type="text" name="housePrice" class="login-box-cen-form-input w180"
placeholder="请输入期望售价" id="reg_info_address"/>
<!-- <label class="err err-top40" id="reg_info_address_text">公司所在地址,不超过40个字</label>-->
<div id="parent">
<select name="price_unit">
<option>元/套</option>
<option>元/月</option>
<option>元/年</option>
</select>
</div>
</div>
</div>
<!--FIXME 房源头像图-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian"></em>房源头像图</label>
<div class="register-box-con2-box-right">
<label class="register-box-con2-box-upload">
<input type="file" name="houseHeadimg" id="headimg"/>
<div class="register-box-con2-box-upload-ti">
<em id="headimg_w">点击上传</em>
<img id="headimg_base64" style="display:none;"/>
</div>
</label>
<label class="err err-top160" id="headimgText">支持图片格式JPG/PNG,图片大小不超过2M</label>
</div>
</div>
<!--FIXME 房源平面图-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left">
<em class="bitian">
</em>房源平面图</label>
<div class="register-box-con2-box-right">
<!--第一张图片-->
<label class="register-box-con2-box-upload1">
<input type="file" name="housePlanimg1" id="planimg1"/>
<div class="register-box-con2-box-upload-ti1">
<em id="planimg1_w">上传</em>
<img id="planimg1_base64" style="display:none;"/></div>
</label>
<!--第二张图片-->
<label class="register-box-con2-box-upload1" style=" margin-left: 10px;">
<input type="file" name="housePlanimg2" id="planimg2"/>
<div class="register-box-con2-box-upload-ti1">
<em id="planimg2_w">上传</em>
<img id="planimg2_base64" style="display:none;"/></div>
</label>
<label class="err err-top160" id="planimg1Text">支持图片格式JPG/PNG,图片大小不超过2M</label>
</div>
</div>
<!--FIXME 房源室内图-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left">
<em class="bitian"></em>房源室内图
</label>
<div class="register-box-con2-box-right">
<!--第一张图片-->
<label class="register-box-con2-box-upload2">
<input type="file" name="houseImg1" id="inter1"/>
<div class="register-box-con2-box-upload-ti2"><em id="inter1_w">上传</em><img
id="inter1_base64" style="display:none;"/></div>
</label>
<!--第二章图片-->
<label class="register-box-con2-box-upload2" style=" margin-left: 10px;">
<input type="file" name="houseImg2" id="inter2"/>
<div class="register-box-con2-box-upload-ti2"><em id="inter2_w">上传</em><img
id="inter2_base64" style="display:none;"/></div>
</label>
<!--第三张图片-->
<label class="register-box-con2-box-upload2" style=" margin-left: 10px;">
<input type="file" name="houseImg3" id="inter3"/>
<div class="register-box-con2-box-upload-ti2"><em id="inter3_w">上传</em><img
id="inter3_base64" style="display:none;"/></div>
</label>
<label class="err err-top160" id="inter2_text">支持图片格式JPG/PNG,图片大小不超过2M</label>
</div>
</div>
<!--第二行图片-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian"></em></label>
<div class="register-box-con2-box-right">
<!--第四张图片-->
<label class="register-box-con2-box-upload2">
<input type="file" name="houseImg4" id="inter4"/>
<div class="register-box-con2-box-upload-ti2"><em id="inter4_w">上传</em><img
id="inter4_base64" style="display:none;"/></div>
</label>
<!--第五张图片-->
<label class="register-box-con2-box-upload2" style=" margin-left: 10px;">
<input type="file" name="houseImg5" id="inter5"/>
<div class="register-box-con2-box-upload-ti2">
<em id="inter5_w">上传</em>
<img id="inter5_base64" style="display:none;"/>
</div>
</label>
<!--第六章图片-->
<label class="register-box-con2-box-upload2" style=" margin-left: 10px;">
<input type="file" name="houseImg6" id="inter6"/>
<div class="register-box-con2-box-upload-ti2">
<em id="inter6_w">上传</em>
<img id="inter6_base64" style="display:none;"/></div>
</label>
<label class="err err-top160" id="inter3_text">支持图片格式JPG/PNG,图片大小不超过2M</label>
</div>
</div>
<!--End 房源室内图-->
<div class="register-box-con2-box clearfix mar-bottom20 mar-top50">
<label class="register-box-con2-box-left"></label>
<div class="register-box-con2-box-right">
<input type="submit" value="下一步" class="login-box-cen-form-button" style="width: 360px"
id="reg_info_submit"/>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<br/><br/>
</div>
<script type="text/javascript" src="../js/jqueryhouse.min.js"></script>
<script type="text/javascript" src="../js/tbdValidate.js"></script>
<script type="text/javascript" src="../js/upload.js"></script>
<script src="../js/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
//图片预览路径
function getObjectURL(file) {
var url = null;
if (window.createObjectURL != undefined) { // basic
url = window.createObjectURL(file);
} else if (window.URL != undefined) { // mozilla(firefox)
url = window.URL.createObjectURL(file);
} else if (window.webkitURL != undefined) { // webkit or chrome
url = window.webkitURL.createObjectURL(file);
}
return url;
}
</script>
<!--这是页脚-->
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
<br>
</body>
</html>
housePost2.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>发布房源信息</title>
<!-- 下面是几个导入的包-->
<link type="text/css" href="../css/css.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchInputStyle.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchReset.css" rel="stylesheet"/>
<link rel="stylesheet" href="../css/houseSend.css"/>
<script type="text/javascript" src="../js/js.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<body>
<!--头部最上方的框-->
<jsp:include page="${pageContext.request.contextPath}/pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<!--导航栏-->
<div class="list-nav">
<div class="width1190">
<ul class="nav">
<li><a href="index.jsp">首页</a></li>
<li><a href="#">新房</a></li>
<li><a href="#">二手房</a></li>
<li><a href="#">租房</a></li>
<li class="zhiding"><a href="#">指定购房</a></li>
<li><a href="${pageContext.request.contextPath}/pages/housePost1.jsp">发布房源</a></li>
<li><a href="#">公告中心</a></li>
<li><a href="#">关于我们</a></li>
<div class="clears"></div>
</ul><!--nav-->
<div class="clears"></div>
</div><!--width1190-->
</div><!--list-nav-->
<!--导航栏End-->
<%--信息填写栏--%>
<div class="width1190">
<br/>
<h4 style="font-size:16px; text-align:center; font-weight:bold;">房源详细信息填写</h4>
<br/>
<!--中心-->
<div class="content">
<div class="register-box">
<div class="wrap">
<div class="register-box-con2">
<!--房源性质-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源性质</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseNature"
placeholder="如:商品房、住宅房等" id="house_natuer"/>
</div>
</div>
<!--房源类型-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源类型</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseModel"
placeholder="如:普通住宅、公寓式住宅、别墅等" id="house_model"/>
</div>
</div>
<!--房源建造年-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源建造年</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseYear"
placeholder="如:2008、2019等" id="house_year"/>
</div>
</div>
<!--房源期限-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源期限</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseValid"
placeholder="如:70年、80年、永久等" id="house_valid"/>
</div>
</div>
<!--房源户型-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源户型</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseLayout"
placeholder="如:2厅4室2卫等" id="house_layout"/>
</div>
</div>
<!--房源面积-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源面积</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseArea"
placeholder="如:100、85等。单位:m²" id="house_narea"/>
</div>
</div>
<!--房源朝向-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源朝向</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseTurn"
placeholder="如:南北、西南等" id="house_turn"/>
</div>
</div>
<!--房源楼层-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源楼层</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseFloor"
placeholder="如:6、8、9等" id="house_floor"/>
</div>
</div>
<!--总楼层-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>总楼层</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="floorAll"
placeholder="如:7、13、16等" id="floor_all"/>
</div>
</div>
<!--装修类型-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>装修类型</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseDecorate"
placeholder="如:精装修、简装修等" id="house_decorate"/>
</div>
</div>
<!--是否有电梯-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>是否有电梯</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseLift"
placeholder="如:是、否等" id="house_lift"/>
</div>
</div>
<div class="register-box-con2-box clearfix mar-bottom20 mar-top50" align="center">
<label class="register-box-con2-box-left"></label>
<div class="register-box-con2-box-right" align="center">
<input type="button" value="下一步" class="login-box-cen-form-button w180" id="next_submit"/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="../js/jqueryhouse.min.js"></script>
<script type="text/javascript" src="../js/tbdValidate.js"></script>
<script type="text/javascript" src="../js/upload.js"></script>
<script src="../js/jquery-2.1.1.min.js"></script>
<!--这是页脚-->
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
<script type="text/javascript">
$(function () {
$("#next_submit").on("click",function () {
var houseNature = $("input[name=houseNature]").val();
var houseModel = $("input[name=houseModel]").val();
var houseYear = $("input[name=houseYear]").val();
var houseValid = $("input[name=houseValid]").val();
var houseLayout = $("input[name=houseLayout]").val();
var houseArea = $("input[name=houseArea]").val();
var houseTurn = $("input[name=houseTurn]").val();
var houseFloor = $("input[name=houseFloor]").val();
var floorAll = $("input[name=floorAll]").val();
var houseDecorate = $("input[name=houseDecorate]").val();
var houseLift;
if ($("input[name=houseLift]").val() == "是") {
houseLift = 1;
} else {
houseLift = 0;
}
//校验信息
if (houseNature == "") {
alert("请输入房源性质!");
return;
}
else if (houseModel == "") {
alert("请输入房源类型!");
return;
}
else if (houseYear == "") {
alert("请输入建造时间!");
return;
}
else if (houseValid == "") {
alert("请输入房源期限!");
return;
}
else if (houseLayout == "") {
alert("请输入房源户型!");
return;
}
else if (houseArea == "") {
alert("请输入房源面积!");
return;
}
else if (houseTurn == "") {
alert("请输入朝向!");
return;
}
else if (houseFloor == "") {
alert("请输入楼层!");
return;
}
else if (floorAll == "") {
alert("请输入预售价格!");
return;
}
else if (houseDecorate == "") {
alert("请输入装饰类型!");
return;
} else if (houseLift == "") {
alert("请说明有无电梯!");
return;
}else {
$.ajax({
url:"${pageContext.request.contextPath}/house/responsePost2.do",
type:"post",
dataType:"json",
data:{
houseNature:houseNature,
houseMosel:houseModel,
houseYear:houseYear,
houseValid:houseValid,
houseLayout:houseLayout,
houseArea: houseArea,
houseTurn:houseTurn,
houseFloor:houseFloor,
floorAll:floorAll,
houseDecorate:houseDecorate,
houseLift:houseLift
},
success:function () {
window.location.href="${pageContext.request.contextPath}/pages/housePost3.jsp"
}
})
}
});
})
获取几个基本信息
</script>
</html>
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/136723.html