aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Confusion, HFSJ Page 385 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Confusion, HFSJ Page 385" Watch "Confusion, HFSJ Page 385" New topic
Author

Confusion, HFSJ Page 385

Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707
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,


cmbhatt
swarna dasa
Ranch Hand

Joined: Mar 15, 2007
Posts: 108
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

Joined: Feb 28, 2007
Posts: 1707
Very nice description Swarna!

Got it.



Thanks,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confusion, HFSJ Page 385