MDYDXWLO$UUD\/LVWOLVW QHZMDYDXWLO$UUD\/LVW OLVWDGG ³WUXH´ OLVWDGG ³IDOVH´ OLVWDGG ³´ OLVWDGG ³´ UHTXHVWVHW$WWULEXWH ³OLVW´OLVW 6KDUSHQ \RXU SHQFLO IDOVHIDOVHIDOVHIDOVHIDOVH WUXHWUXHWUXH
Trang 2\RXDUHKHUH
AW]KIV¼\LW^IRR`
7ITHTHING
QXPVDGG³´ QXPVDGG³´ UHTXHVWVHW$WWULEXWH³QXPEHUV´QXPV 6WULQJ>@IDYRULWH0XVLF ^³=HUR´³7DKLWL´³%7´³)URX)URX´`
Trang 3FKDSWHU
$ONTTHISLOOK
3TUDYTHECONSTRUCTTHATLLBROWSER
NOTGOING
Trang 6\RXDUHKHUH
<PM-4QUXTQKQ\WJRMK\[
2EMEMBER AREFORAT9OULLSIMPLE
SDUDP9DOXHV KHDGHU KHDGHU9DOXHV FRRNLH LQLW3DUDP
Ooohhhh this is a tough one
could it be a Map of cookies?
(NOT servlet init parameters!)
The only thing that is NOT a Map T his is the real dealÑan actual ref erence to the pageContext object, which you can think of as
a bean Look in the API for the P ageContext getter methods
Trang 7Þ elds before hitting the submi t button
Even though there might be multiple values for the ÒfoodÓ parameter, you can still use the single param implicit object, but youÕll get only the Þ rst value.
SDUDPDQG SDUDP9DOXHV
Trang 8+LQWORRNDWWKHRWKHULPSOLFLWREMHFWV
Trang 10\RXDUHKHUH
;KWXMQUXTQKQ\WJRMK\[KIV[I^MaW]
)FDONTYOUJUST
/R CAN
^ UHTXHVW6FRSH SHUVRQQDPH`
"UTATTRIBUTECONTROLSCOPING
4HINKIN
*AVAISSOMEWHERE
UHTXHVWVHW$WWULEXWH³SHUVRQ´S
"UT
3TRINGS4HATCOULD
UHTXHVWVHW$WWULEXWH³IRRSHUVRQ´S
!ND
^ IRRSHUVRQ QDPH`
"UTSCOPE3TRING
NO! This is certainly legal, but the Container
just thinks that ÒfooÓ is an attribute
somewhere, with a ÒpersonÓ property But the
Container never Þnds a ÒfooÓ attribute.
Perfect! Using the requestScope object gives
us a way to put the attribute name in quotes.
Trang 11&RRNLH>@FRRNLHV UHTXHVWJHW&RRNLHV IRULQWL LFRRNLHVOHQJWKL ... class="text_page_counter">Trang 26< /span>
aces it into the ỊContact .jsp? ?
SURSULHWDU\(YDOXDWH³^LQLW3DUDPPDLQ(PDLO`´MDYDODQJ6WULQJFODVV... only used by servlets.
PRFN DQVZHUV
Trang 56< /span>-Options C and F will cause... loggedOut is true.
(JSP v2.0 pg 1 -69 )
-Option B is incorrect because only the [] will work when accessing a) Lists and arrays, and b) Maps whose keys are not well-formed.