JSP data exchange (b)

A, application: application-level object
   respective client data shared
       method:
          the setAttribute (String Key, Object value)
          the getAttribute (String Key)
          the getRealPath ( "virtual path"); obtaining the physical path according to a virtual path
two, Cookie: save specific information client
    usage:
      1. create a
        Cookie CK = new new Cookie (String Key, String value)
        ck.setMaxAge ( "time"), set the effective time, do not fail to set the default browser is closed
      2. save
        response.addCookie (ck) ;
      3. read cookie
         a.Cookie [] = request.getCookies CKS ();
         B traversal.
           getName (): Get the current name of the cookie (keys)
           the getValue (): Get the current value of the cookie
three, session and the cookie difference
          session cookie
    Stored in the server's memory stored on the client's hard disk
    to save a String object type Save
    to save temporary data permanently stored data
    safe poor security

Guess you like

Origin www.cnblogs.com/liuying23/p/11127856.html