This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Assignment of an Array to a key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Assignment of an Array to a key" Watch "Assignment of an Array to a key" New topic
Author

Assignment of an Array to a key

Padma priya Gururajan
Ranch Hand

Joined: Oct 05, 2006
Posts: 434
Hi,
Please look at the following code:
String[] favoriteMusic = { "Zero7","BT","Frou Frou"};
request.setAttribute("musicList","favoriteMusic");



Is it correct to assign a string array to a key called "musicList".


With regards,
Padma priya N.G.


Padma priya N.G.
Be the change you want to be - Mahatma Gandhi
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You've got extra double quotations. It should be :


Yes it's ok, because as you know, arrays behave like any objects.


[My Blog]
All roads lead to JavaRanch
Padma priya Gururajan
Ranch Hand

Joined: Oct 05, 2006
Posts: 434
Hi,
Thanks.
Padma priya N.G.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Assignment of an Array to a key
 
Similar Threads
Unable to display arrays in JSP
Unable to understand the solution on EL
EL and quotes (HFSJ pg373)
HFSJ EL e.g. page 371
Unable to display the content in array(created in the servlet)using JSP!