Forums Register Login

Doubt on EL-Page 429

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
"I know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 595 times.
Similar Threads
Doubt in EL
Doubt on EL
Doubt on Welcome files
Doubt on Tag Handlers
Doubt on Web Application Deployment
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 22:58:16.