易居住房7(注册+个人中心页面显示)

在“易居住房6”的基础上进行增加或修改代码

注册
“IUserDao.java”增加代码

    void singup(@Param("phone") String phone,@Param("password") String password);

“IUserService.java”增加代码

    void add(String phone, String password);

“UserService.java”增加代码

	@Override
    public void add(String phone, String password) {
        userDao.singup(phone,password);
    }

“UserController.java”增加代码
“登录”代码的修改
@Param(value = "password") String password,后加HttpSession session;在jsonObject.put("result","2");前加session.setAttribute("user",user);;增加“singup.do”代码块

	@RequestMapping("singup.do")
    @ResponseBody
    public String singup(@Param(value = "phone") String phone,
                         @Param(value = "password") String password){
        //1.查看该手机号是否注册
        //2.已注册提示,跳转到登录页面
        //3.没有注册,需注册
        JSONObject jsonObject=new JSONObject();
        UserInfo user=userService.findUserByPhon(phone);
        if (user==null){
            userService.add(phone,password);
            jsonObject.put("result","0");
        } else if (!password.equals(user.getPassword())){
            jsonObject.put("result","1");
        } else {
            jsonObject.put("result","2");
        }
        return jsonObject.toString();
    }

“UserInfoMapper.xml”增加代码

<select id="singup" parameterType="String">
        insert into tb_user(phone,password) values (#{phone},#{password})
    </select>

“pages”中添加“signup.jsp”–注册页面,“personal.jsp”–个人中心页面
在这里插入图片描述
“signup.jsp”代码如下

<%--
  Created by IntelliJ IDEA.
  User: 36353
  Date: 2019-07-03
  Time: 16:38
  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 type="text/css" href="../css/buttonStyle.css" rel="stylesheet" />

    <%--导入JS文件--%>
    <script src="../js/jquery-2.1.1.min.js"></script>
    <%--<script src="js/signup.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栏和手机号栏-->


<!--Logo栏和手机号栏-->

<hr width="1280px">

<!--注册-->
<div class="content&
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值