• Post Reply Bookmark Topic Watch Topic
  • New Topic

EL question  RSS feed

 
julius hock
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In HFSJ book -> Scriptless JSPs chapter -> Mock Exam Chapter 8 -> pg. 417 -> question 2.

Given that a web application stores the webmaster email address in the servlet context initialization parameter called master-email. Which retrieves that value?
why is the A. wrong? Can anyone explain?

A. <a href='mailto:${initParam.master-email}'>email me</a>

Thanks.
 
Selvaraj Subramanian
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Its wrong because '-' considered as an Arithmetic Operator.
Here, it will be searching for an init param under "master" and then it will subtract it with "email" attribute if it exists.

So, attribute name should follow java naming rules. In java also we cannot have '-' in a variable name.
 
julius hock
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks Selva.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!