Reading Notes for Chapter 8, Head First Servlets and JSP

Table of Contents

341 Script-free pages 373 (p. 372 continued) 404 The <jsp:include> standard action at first request
342 Objectives 374 For beans and Maps you can use either operator 405a The attribute names are different for the include directive and <jsp:include>
343 Our MVC app depends on attributes 375 If it's NOT a String literal, it's evaluated 405b The include directive is position-sensitive!
344 But what if the attribute is not a String, but an instance of Person? 376 You can use nested expressions inside the brackets 405c Q and A
345 We need more code to get the Person's name 377 You can't do ${foo.1} 406 "You've got nested HTML and BODY tags!" Uh-oh. She's right.
346 Person is a JavaBean, so we'll use the bean-related standard actions 378 Code Magnets (EL) 407 The way we SHOULD have done it
347 Deconstructing <jsp:useBean> and <jsp:getProperty> 379 (p. 378 continued) 408 Customizing the included content with <jsp:param>
348 <jsp:useBean> can also CREATE a bean; 380 Code Magnets Answers (p. 378-379) 409 The <jsp:forward> standard action
349 You can use <jsp:setProperty> 381 The EL implicit objects 410 A conditional forward
350 <jsp:useBean> can have a body! 382 Request parameters in EL 411 How it runs...
351 Generated servlet when <jsp:useBean> has a body 383 What if you want more information from the request? 412 With <jsp:forward>, the buffer is cleared BEFORE the forward
352 Can you make polymorphic bean references? 384 The requestScope is NOT the request object 413 She doesn't know about JSTL tags
353 Adding a type attribute to <jsp:useBean> 385 Scope implicit objects can save you 414 Bean-related standard action review
354 Using type without class 386 Getting Cookies and init params 415 The include review
355 The scope attribute defaults to "page" 387 She doesn't know about EL functions 416 Be the Container ANSWERS (from p. 356)
356 Be the Container: (standard actions, JSPs, and servlets) 388 Imagine you want your JSP to roll dice 417 Coffee Cram Q1, Q2
357 Going straight from the request to the JSP without going through a servlet 389 The function class, the TLD, and the JSP 418 Coffee Cram Q3
358 The param attribute to the rescue 390 Deploying an app with static functions 419 Coffee Cram Q4, Q5
359 But wait! It gets even better... 391a There are no dumb questions 420 Coffee Cram Q6, Q7
360 If you can stand it, it gets even BETTER... 391b The METHOD name is not the same as the FUNCTION name 421 Coffee Cram Q8, Q9, Q10
361 Bean tags convert primitive properties automatically 392 And a few other EL operators 422 Coffee Cram Q11, Q12, Q13
362 There are no dumb questions 393 Sharpen your pencil (EL) 423 Coffee Cram Q14, Q15
363 The bean standard action tags are more natural to a non-programmer 394 Sharpen your pencil answers (from p. 393) 424 Coffee Cram Q16, Q17, Q18
364 But what if the property is something OTHER than a String or a primitive 395 EL handles null values gracefully 425 Coffee Cram Answers Q1, Q2
365 Trying to display the property of the property 396 JSP Expression Language (EL) review 426 Coffee Cram Answers Q3
366 Expression Language (EL) saves the day! 397 [Web designer thought bubbles] "Yeah, I haven't heard ONE thing about using layout templates." 427 Coffee Cram Answers Q4, Q5
367 Deconstructing the JSP Expression Language (EL) 398 Reusable template pieces 428 Coffee Cram Answers Q6, Q7
368 Using the dot (.) operator to access properties and map values 399 The include directive 429 Coffee Cram Answers Q8, Q9, Q10
369 The [] operator is like the dot only way better 400 The <jsp:include> standard action 430 Coffee Cram Answers Q11, Q12, Q13
370 The [] gives you more options... 401 They're NOT the same underneath 431 Coffee Cram Answers Q14, Q15
371 Using the [] operator with an array 402 The include directive happens at translation time
<jsp:include> happens at runtime
432 Coffee Cram Answers Q16, Q17, Q18
372 A String index is coerced to an int for arrays and Lists 403 The include directive at first request    

p341 Script-free pages

@@@

p342 Objectives

@@@

p343 Our MVC app depends on attributes

@@@

p344 But what if the attribute is not a String, but an instance of Person?

@@@

p345 We need more code to get the Person's name

@@@

p346 Person is a JavaBean, so we'll use the bean-related standard actions

@@@

p347 Deconstructing <jsp:useBean> and <jsp:getProperty>

@@@

p348 <jsp:useBean> can also CREATE a bean;

@@@

p349 You can use <jsp:setProperty>

@@@

p350 <jsp:useBean> can have a body!

@@@

p351 Generated servlet when <jsp:useBean> has a body

@@@

p352 Can you make polymorphic bean references?

@@@

p353 Adding a type attribute to <jsp:useBean>

@@@

p354 Using type without class

@@@

p355 The scope attribute defaults to "page"

@@@

p356 Be the Container: (standard actions, JSPs, and servlets)

@@@

p357 Going straight from the request to the JSP without going through a servlet

@@@

p358 The param attribute to the rescue

@@@

p359 But wait! It gets even better...

@@@

p360 If you can stand it, it gets even BETTER...

@@@

p361 Bean tags convert primitive properties automatically

@@@

p362 There are no dumb questions

@@@

p363 The bean standard action tags are more natural to a non-programmer

@@@

p364 But what if the property is something OTHER than a String or a primitive

@@@

p365 Trying to display the property of the property

@@@

p366 Expression Language (EL) saves the day!

@@@

p367 Deconstructing the JSP Expression Language (EL)

@@@

p368 Using the dot (.) operator to access properties and map values

@@@

p369 The [] operator is like the dot only way better

@@@

p370 The [] gives you more options...

@@@

p371 Using the [] operator with an array

@@@

p372 A String index is coerced to an int for arrays and Lists

@@@

p373 (p. 372 continued)

@@@

p374 For beans and Maps you can use either operator

@@@

p375 If it's NOT a String literal, it's evaluated

@@@

p376 You can use nested expressions inside the brackets

@@@

p377 You can't do ${foo.1}

@@@

p378 Code Magnets (EL)

@@@

p379 (p. 378 continued)

@@@

p380 Code Magnets Answers (p. 378-379)

@@@

p381 The EL implicit objects

@@@

p382 Request parameters in EL

@@@

p383 What if you want more information from the request?

@@@

p384 The requestScope is NOT the request object

@@@

p385 Scope implicit objects can save you

@@@

p386 Getting Cookies and init params

@@@

p387 She doesn't know about EL functions

@@@

p388 Imagine you want your JSP to roll dice

@@@

p389 The function class, the TLD, and the JSP

@@@

p390 Deploying an app with static functions

@@@

p391a There are no dumb questions

@@@

p391b The METHOD name is not the same as the FUNCTION name

@@@

p392 And a few other EL operators

@@@

p393 Sharpen your pencil (EL)

@@@

p394 Sharpen your pencil answers (from p. 393)

@@@

p395 EL handles null values gracefully

@@@

p396 JSP Expression Language (EL) review

@@@

p397 [Web designer thought bubbles] "Yeah, I haven't heard ONE thing about using layout templates."

@@@

p398 Reusable template pieces

@@@

p399 The include directive

@@@

p400 The <jsp:include> standard action

@@@

p401 They're NOT the same underneath

@@@

p402 The include directive happens at translation time
<jsp:include> happens at runtime

@@@

p403 The include directive at first request

@@@

p404 The <jsp:include> standard action at first request

@@@

p405a The attribute names are different for the include directive and <jsp:include>

@@@

p405b The include directive is position-sensitive!

@@@

p405c Q and A

@@@

p406 "You've got nested HTML and BODY tags!" Uh-oh. She's right.

@@@

p407 The way we SHOULD have done it

@@@

p408 Customizing the included content with <jsp:param>

@@@

p409 The <jsp:forward> standard action

@@@

p410 A conditional forward

@@@

p411 How it runs...

@@@

p412 With <jsp:forward>, the buffer is cleared BEFORE the forward

@@@

p413 She doesn't know about JSTL tags

@@@

p414 Bean-related standard action review

@@@

p415 The include review

@@@

p416 Be the Container ANSWERS (from p. 356)

@@@

p417 Coffee Cram Q1, Q2

@@@

p418 Coffee Cram Q3

@@@

p419 Coffee Cram Q4, Q5

@@@

p420 Coffee Cram Q6, Q7

@@@

p421 Coffee Cram Q8, Q9, Q10

@@@

p422 Coffee Cram Q11, Q12, Q13

@@@

p423 Coffee Cram Q14, Q15

@@@

p424 Coffee Cram Q16, Q17, Q18

@@@

p425 Coffee Cram Answers Q1, Q2

@@@

p426 Coffee Cram Answers Q3

@@@

p427 Coffee Cram Answers Q4, Q5

@@@

p428 Coffee Cram Answers Q6, Q7

@@@

p429 Coffee Cram Answers Q8, Q9, Q10

@@@

p430 Coffee Cram Answers Q11, Q12, Q13

@@@

p431 Coffee Cram Answers Q14, Q15

@@@

p432 Coffee Cram Answers Q16, Q17, Q18

Check the unconfirmed errata for this page!

@@@

 

 


End of CISC474 reading notes for HFSJ, Chapter 8


Valid XHTML 1.1 Valid CSS!