1. Trang chủ
  2. » Công Nghệ Thông Tin

Head First Servlets and JSP phần 4 ppsx

74 224 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 74
Dung lượng 2,52 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

We donÕt want Terri and DianeÕs answers mixed up...so they each need their own separate session object... This method does mor e than just create a session, but the FIRS T time you inv

Trang 1

We donÕt want Terri and DianeÕs answers mixed up

so they each need their own separate session object.

Trang 2

UHFRJQL]LQJWKH FOLHQW

Trang 3

\RXDUHKHUH 

+WWS6HVVLRQ,'

+WWS6HVVLRQ,'

Trang 5

do anything else!

(This method does mor e than just create a session, but the FIRS T time you invoke it on the r equest, it will cause a cookie t o be sent with the response Now, ther eÕs still not guarantee the cli ent will ACCEPT the cookie but weÕr e getting ahead

of ourselves.)

*HWWLQJWKHVHVVLRQ,'IURPWKH5(48(67

+WWS6HVVLRQVHVVLRQ UHTXHVWJHW6HVVLRQ ,OOK

as SENDING a session ID cooki

e

You never actually SEE the session

ID yourself (although you can ask the session to give it to you).

Trang 6

isNew() returns true if the client has not yet resp onded with this session ID.

Trang 7

Here we KNOW weÕre making a new session.

Trang 8

)FGET3ESSION

Trang 9

We add the session ID to the end

of all the URLs in the HTML we send back in the Response.

The session ID comes back as ÒextraÓ info stuck to the end of the Request URL (The semicolon separator is vendor-speciÞ c.)+7735HVSRQVH

+7735HTXHVW

Trang 10

#ONTAINERSESSION CAN)LLNEED

85/ UHZULWLQJ

Trang 12

DonÕt do this! ItÕs supposed to be a header!

This is right, but you donÕt do it your self. The result of

URL rewriting (you donÕt do this yourself either).

Trang 13

\RXDUHKHUH 

/M\\QVOZQLWN[M[[QWV[

4HEMINDSESSION

IN MAKINGCOMPUTER

4HEWANT2EMEMBER MECHANISMGONE

YOU

"UTCLIENTTHE

(He wants to conserve space

on his machine for playing

ÒThe SimsÓ with the ÒHot

DateÓ expansion pack.)

Trang 15

LPH 6WULQJJHW,G ORQJJHW/DVW$FFHVVHG7

LPH LQWJHW0D[,QDFWLYH,QWHUYDO 6HUYOHW&RQWH[WJHW6HUYOHW&RQWH[W ... class="text_page_counter">Trang 44

 FKDSWHU

#HOOSEVALUE

Trang 46 Trang 41



Trang 43

\RXDUHKHUH... 

/M\\QVOZQLWN[M[[QWV[

4HEMINDSESSION

IN MAKINGCOMPUTER

4HEWANT2EMEMBER MECHANISMGONE

YOU

&# 34; UTCLIENTTHE

(He wants to conserve

Ngày đăng: 12/08/2014, 19:20

TỪ KHÓA LIÊN QUAN