This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

what is the different between single quote and double quote in EL

 
Henry Zhi Lin
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I just finish chapter 8 from Head first Servlet and JSP book. When I am doing the mock test ater this chapter I encounter the following question:

Given that a web application stores the webmaster email address in the
servlet context initialization parameter called master-email.
Which retrieves that value? (Choose all that apply.)
A. < a href='mailto:${initParam.master-email}'>
email me </a>
B. < a href='mailto:${contextParam.master-email}'>
email me </a>
C. <a href='mailto:${initParam[‘master-email’]}'>
email me </a>
D. <a href='mailto:${contextParam[‘master-email’]}'>
email me </a>


The answer is C

Note here it used single quote, I have tried the double quote as well it works here.

But whenI tried the single quote the following code it returns null to me




The HTML shows list['0'] answer is :

So my question is why this time the single quote does not work with second program. Does it mean it can only use with initParam

WHat the difference between the usage of single quote and double quote here?

Thanks for any answering first!

 
Ankit Garg
Sheriff
Posts: 9597
36
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HTML shows list['0'] answer is :

So my question is why this time the single quote does not work with second program.


Did you set an attribute named list in any scope??
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65659
129
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you quote a numeric value? Think!
 
Henry Zhi Lin
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote:
The HTML shows list['0'] answer is :

So my question is why this time the single quote does not work with second program.


Did you set an attribute named list in any scope??


I guess you are right I forgot to set the attribute to request, that is why

The HTML shows list['0'] answer is :


return nothing, thanks.

So I think the answer is no different between single quote and double quote in my example!
 
Ankit Garg
Sheriff
Posts: 9597
36
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Why would you quote a numeric value? Think!

Not for real life but for SCWCD
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!