Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EL expressions  RSS feed

 
Sunjeev Shetty
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which EL expression evaluates to the request URI?
a)${requestURI}
b)${request.URI}
c)${${request.getURI}
d)${request.requestURI}
e)${requestScope.requestURI}
f)${pageContext.request.requestURI}
g)${requestScope.request.request.URI}

I think the answer is f .The answer given is a.

Given an EL function foo in namespace func ,that requires a long as a parameter and returns a map which two are valid invocations of functions foo?
a)${func(1)}
b)${foo:func(4)}
c)${func:foo(2)}
d)${foo(5):func}
e)${func:foo("easy")}
f)${func:foo("3").name}

I think one option is c .What is other one.
Thanks
 
Sue Pillai
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the first question, I think your answer is correct. The option A prints nothing. In case of the second question, I don't see any other valid option.

Correct me if I am wrong guys
 
Ravi Appana
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"f" should be the other correct option in the second question, since the return value of the function is a map, and "name" might be the key for which the value is being shown from that expression.
 
jim bop
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
f)${pageContext.request.requestURI}


c)${func:foo(2)}
e)${func:foo("easy")}

would the string coerce to a long?
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question 1: option f

Question 2: option c,f
 
Vivek Swamy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For question 1 the answer is (f) and for question 2 the only correct answer i think is (c). Not sure why the questiong expects two correct choices. (f) is wrong since the function expects long. It wont automatically do new Long("3").longValue().
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!