This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confusion, HFSJ Page 385

 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am not able to grasp the following line of HFSJ page 385:
Think about the scenario, if you have a name that's not in quotes in brackets[], that means it MUST adhere to Jana naming rules, right? Here, we're OK, because person is perfectly legal Java variable name. But that's because somewhere, someone said
,

request.setAttibute("person",p);

But the attribute name is a String.

Strings dont follpow Java variable name rules.
...
...


Please help me!



Thanks,
 
swarna dasa
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String could be "1234"

so you could say request.setAttibute("1234",p);

but with dot operator, 1234 is not a valid java identifier, so you cant say
pageContext.request.1234 //wrong

can say
requestScope["1234"]
or
pageContext.request["1234"]
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very nice description Swarna!

Got it.



Thanks,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic