新頁面的登入

來源:互聯網
上載者:User

標籤:



html1中index.html

<a th:href="@{initGuestLogin}" class="link" > <span th:if="${ #strings.isEmpty(session.UVO.guestName)}">登入</span></a>

GustController.java

 @RequestMapping(value = "initGuestLogin", method = RequestMethod.GET)

    public String initGuestLogin(Model model, Device device) {

    log.info("客戶登入介面初始化");

    GoodsForm goodsForm = new GoodsForm();

    goodsForm.setType("糧食");

    model.addAttribute("goodsForm", goodsForm);

    List<CartForm> cartList = new ArrayList<>();

    model.addAttribute("cartList", cartList);

    GuestForm guestForm = new GuestForm();

    model.addAttribute("guestForm", guestForm);

    if(device.isNormal()) {

    return "shop/login";

    } else {

    return "mobile/login";

    }

    }

login.html

<div class="container mt20 regBox ">

<form  action="guestLogin" class="form-horizontal" th:object="${guestForm}"  method="post">

  <div class="form-group">

   <label for="inputEmail3" class="col-sm-4 control-label">使用者名稱:</label>

   <div class="col-sm-8">

    <input type="text"  name="guestId"  class="form-control" />

   </div>

  </div>

  <div class="form-group">

   <label for="inputPassword3" class="col-sm-4 control-label">密 碼:</label>

   <div class="col-sm-8">

      <input type="password" name="password"  class="form-control"/>

      <i class="formInfo red">密碼錯誤</i>

   </div>

  </div>

 

  <div class="form-group">

   <div class="col-sm-offset-4 col-sm-8">

      <div class="checkbox w300 cf"><label class="fl"><input type="checkbox"/> 記住密碼</label><a href="#" class="fr link">忘記密碼?</a></div>

   </div>

  </div>

  <div class="form-group">

   <div class="col-sm-offset-4 col-sm-8">

     <button type="submit" class="btnYellow yh">登 錄</button>

   

   </div>

  </div>

</form>



GustController.java

@R equestMapping(value = "guestLogin", method = RequestMethod.POST)

    public String guestLogin(Model model, HttpSession session, GuestForm guestForm, Device device) {

log.info("客戶登入,驗證客戶資訊,成功後進入系統");

GuestForm result = guestService.searchGuest(guestForm);

if(result != null) {

UVO uvo = new UVO();

uvo.setGuestId(result.getGuestId());

uvo.setGuestName(result.getGuestName());

uvo.setPassword(guestForm.getPassword());

uvo.setGender(result.getGender());

uvo.setAddress(result.getAddress());

uvo.setEmail(result.getEmail());

uvo.setMobile(result.getMobile());

uvo.setQq(result.getQq());

uvo.setPhone(result.getPhone());

uvo.setZip(result.getZip());

session.setAttribute("UVO", uvo);

GoodsForm goodsForm = new GoodsForm();

    goodsForm.setType("糧食");

    model.addAttribute("goodsForm", goodsForm);

    model.addAttribute("list", goodsService.searchGoodsList(goodsForm));

    CartForm cartForm = new CartForm();

    cartForm.setGuestId(uvo.getGuestId());

    model.addAttribute("cartList", cartService.searchCartList(cartForm));

    if(device.isNormal()) {

    return "shop/index";

    } else {

    return "mobile/index";

    }

} else {

model.addAttribute("message", "使用者名稱或密碼錯誤!");

GoodsForm goodsForm = new GoodsForm();

    goodsForm.setType("糧食");

    model.addAttribute("goodsForm", goodsForm);

    List<CartForm> cartList = new ArrayList<>();

    model.addAttribute("cartList", cartList);

if(device.isNormal()) {

    return "shop/login";

    } else {

    return "mobile/login";

    }

}

}


新頁面的登入

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.