Login for new page

Source: Internet
Author: User



HTML1 in index.html

<a th:href= "@{initguestlogin}" class= "link" > <span th:if= "${#strings. IsEmpty (session. uvo.guestname)} "> Login </span></a>

Gustcontroller.java

@RequestMapping (value = "Initguestlogin", method = Requestmethod.get)

Public String Initguestlogin (model model, device device) {

log.info ("Client Login Interface initialization");

goodsform goodsform = new Goodsform ();

goodsform.settype ("food");

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" > User name:</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" > Password:</label>

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

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

<i class= "FormInfo red" > Password error </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"/> Remember password & Lt;/label><a href= "#" class= "fr link" > Forgot password? </a></div>

</div>

</div>

<div class= "Form-group " >

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

<button type= "Submit" class= "Btnyellow yh" > Login </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 ("Customer login, verify customer information, enter the system after success");

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 ("Food" );

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", "User name or password error!") ");

goodsform goodsform = new Goodsform ();

goodsform.settype ("Food" );

model.addattribute ("Goodsform", Goodsform );

list<cartform> cartlist = new arraylist<> ( );

model.addattribute ("Cartlist", Cartlist );

if (Device.isnormal ()) {

return "Shop/login ";

} else {

return "Mobile/login ";

    }

}

}


Login for new page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.