day26

宜居
结构在这里插入图片描述
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 +
                '}';
    }
}

HouseViewControlle

package com.yiju.controller;


import com.github.pagehelper.PageInfo;
import com.yiju.pojo.HouseView;
import com.yiju.service.IHouseViewService;
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.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@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;
    }
}

IHouseViewDao

package com.yiju.dao;

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(int houseId);
    List<HouseView> findHouseByType(int houseType);
}

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 +
                '}';
    }
}

IHouseViewService

package com.yiju.service;

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);
}

HouseViewService

package com.yiju.service.Impl;

import com.github.pagehelper.PageHelper;
import com.yiju.dao.IHouseViewDao;
import com.yiju.pojo.HouseView;
import com.yiju.service.IHouseViewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HouseViewService implements IHouseViewService {

    @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);
    }
}

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>

</mapper>

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:;">价格 &or;</a>
                <a href="javascript:;">最新 &or;</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="#">首页</a></li>


                    <li>
                        <a href="#">上一页</a>
                    </li>


                    <li>
                        <a href="#">1</a>
                        <a href="#">2</a>
                        <a href="#">3</a>
                    </li>


                    <li>
                        <a href="#">下一页</a>
                    </li>

                    <li>
                        <a href="#"
                           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>

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="#">发布房源</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-->

<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">更多&gt;&gt;</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">更多&gt;&gt;</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="#">更多&gt;&gt;</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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值