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

Doubt on EL-Page 429

 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The following is the question in page 429 of HFSJ
10. ${param.firstname}
11. ${param.middlename}
12. ${param.lastname}
13. ${paramValues.lastname[0]}

Which describes the output produced by this portion of a JSP page when passed the query string ?firstname=John&lastname=Doe?

The answer is John Doe Doe

Can you please tell how the answer is arrived at?

With regards,
Padma priya N.G.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
10. ${param.firstname}
Calls getParameter("firstname") on the request, so "John".

11. ${param.middlename}
Calls getParameter("middlename") on the request, but there's no middlename, so nothing.

12. ${param.lastname}
Calls getParameter("lastname") on the request, so "Doe".

13. ${paramValues.lastname[0]}
Calls getParameterValues("lastname"), which returns an array with only one element, because there's only one lastname in the request. The first element is Doe.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic