Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes 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: 9579
33
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
Pie
Posts: 65335
97
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: 9579
33
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic