9 / 26jsp built-in objects exercises

 

 

 

Use request.getParameter (String) method to get the form to submit data

    

 

 

 Chinese garbage problem occured when submitting data

  

Solution,

  1, the first character string to break iso-8859-1 format, and then makes up a new utf-8 format string

  2, by request.setCharacterEncoding ( "utf-8"); Method

    

 

 

 Receives data normally results

    

 

 

 

 

 

 

 

 

 User name and password is incorrect login failures, failed login using a redirect, url URL location will change, and will display data request carries the information

    

 

 

 Interface of successful login, use URL forwarding url points to does not change, and does not appear to carry the data request

    

 

 userLogin.jsp to determine whether the login success page, login.jsp after a successful login page, loginSuccess.jsp to login page  

 

  

 

 

 

 

Save Username

    

 

 

 Displays the user login name after success

  

 

 

 

Click to log out, return to the login page, open home has been empty session, use removeAttribute (String key) to clear only in the session key, id does not clear itself

    

 

 

 

  Analysis: By session.setAttribute (String key, String value); save data

 

     Getting a property value; by session.getAttribute (String key)

     Delete data; by session.removeAttribute (String key)

      session.getId (): Gets the session id

    

 

 

 

 

 

 

 Login Home reopen closed successfully, findings show signed in

 

 

 

 

 

 

 

 

 

 

 Each time you refresh or reopen the page, the number will be +1

 

 

Guess you like

Origin www.cnblogs.com/zeng1997/p/11595276.html