易居注册+个人中心

  • Post author:
  • Post category:其他



今天的代码主要实现没有账户的用户注册和登录后展现个人中心信息

效果如下

在这里插入图片描述

这是点击立即注册后出现的页面

在这里插入图片描述

在这里插入图片描述

去数据库查看信息

在这里插入图片描述

登录后点击个人中心

在这里插入图片描述



代码如下


结构如下


在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

今天新添加了

personal.jsp

<%@ page import="com.yiju.bean.UserInfo" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 36353
  Date: 2019-07-04
  Time: 14:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>个人中心</title>
    <%--导入CSS文件--%>
    <link type="text/css" href="../css/css.css" rel="stylesheet" />
    <%--<link rel="stylesheet" type="text/css" href="../css/city-select.css">--%>

</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-00000000</strong></div>
                    <div class="clears"></div>
                </td>
            </tr>
        </table>
    </div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->

<hr width="1190px">
<br>

<%--个人信息--%>

<div class="content">
    <div class="width1080">
        <%--左侧导航栏--%>
        <div class="vip-left">
            <div class="vipNav">
                <h3 class="vipTitle">账户中心</h3>
                <dl>
                    <dt class="vipIcon3">账户设置</dt>
                    <dd>
                        <a href="#" class="vipNavCur">我的资料</a>
                        <a href="#">实名认证</a>
                        <a href="#">账户密码设置</a>
                    </dd>
                    <dt class="vipIcon1">我的易居</dt>
                    <dd>
                        <a href="#">我的收藏房源</a>
                    </dd>
                </dl>
            </div><!--vipNav/-->
        </div><!--vip-left/-->

        <%--右侧详情栏--%>
        <div class="vip-right">
            <h3 class="vipright-title">我的资料</h3>
            <table class="grinfo">
                <tbody>

                 <% UserInfo userInfo=(UserInfo) request.getSession().getAttribute("user");%>

                <tr>
                    <th ><span class="red">*</span>手机号码:</th>
                    <td width="600px">
                        <input class="inp inw" type="text" id="phone" value="<%=userInfo.getPhone()%>" maxlength="14" disabled="disabled">
                    </td>
                </tr>
                <tr>
                    <th><span class="red">*</span>姓  名:</th>
                    <td>
                        <input class="inp inw" type="text" id="name" value="<%=userInfo.getTruename()%>" maxlength="14" disabled="disabled">
                    </td>
                </tr>
                <tr>
                    <th><span class="red">*</span>昵  称:</th>
                    <td>
                        <input class="inp inw" type="text" id="title" value="<%=userInfo.getNickname()%>" maxlength="14" disabled="disabled">
                    </td>
                </tr>
                <tr>
                    <th height="40px"><span class="red">*</span>性  别:</th>
                    <td height="40px">
                        <input type="radio" value="0" id="rbSex1" name="sex"
                            <%if (userInfo.getGender()==0) out.print("checked");%>
                        onClick='javascript:return false'>



                        <label for="rbSex1">男        </label>
                        <input type="radio" value="1" id="rbSex2" name="sex"
                            <%if (userInfo.getGender()==1) out.print("checked");%>

                               onClick='javascript:return false'>
                        <label for="rbSex2">女</label>
                        <span id="Sex_Tip"></span>
                    </td>
                </tr>
                <tr>
                    <th><span class="red">*</span>城  市:</th>
                    <td>
                        <input class="inp inw" type="text" id="city" value="<%=userInfo.getCity()%>" maxlength="14" disabled="disabled">
                    </td>
                </tr>

                <tr>
                    <th>&nbsp;</th>
                    <td colspan="2">
                        <label class="butt" id="butt">
                            <input type="submit" class="member_mod_buttom" onclick="window.location.href='#'" value="编辑资料" />
                        </label>
                    </td>
                </tr>
                </tbody>
            </table>
        </div><!--vip-right/-->
        <div class="clearfix"></div>
    </div><!--width1190/-->
</div><!--content/-->
<!--End  个人信息填写栏-->

<div>
    <br>
    <br>
    <br>
    <br>
</div>

<script src="../js/city/jquery1.8.1.js" type="text/javascript"></script>
<%--<script type="text/javascript" src="../js/city/citydata.min.js"></script>--%>
<%--<script type="text/javascript" src="../js/city/citySelect-1.0.3.js"></script>--%>
<script type="text/javascript">
</script>


<!--这是页脚-->
<jsp:include page="../pages/basefoot.jsp"></jsp:include>

</body>
</html>


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 h



版权声明:本文为kou_13原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。