This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

/jsp:include SCWCD Exam Study Kit  RSS feed

Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I would appreciate guidance regarding review question # 6 from Chapter 13 - Reusable Web Components in the book SCWCD Exam Study Kit by Hanumant Deshmukh and Jignesh Malavia.

What I do not understand is how the red and green param values appear in the colors array.

The question is as follows:

File 1: this.jsp

html body pre
jsp:include page="that.jsp"
jsp aram name="color" value="red" /
jsp aram name="color" value="green" /
/pre /body /html

File 2: that.jsp

String colors[] = request.getParameterValues("color");
for (int i=0; i<colors.length; i++)
out.print(colors[i] + " ");

What will be the output of accessing the this.jsp file via the following URL?


The answer is: red green blue


The parameters passed via the <jsp aram> tag to an included component tag take precedence over the parameters already present in the request object of the including component. Also, the order of values passed via the <jsp aram> tag is the same as the order in which the tags appear. Thus, the correct answer is c. The output will be red green blue.

Thank you in advance for your assistance.

Jerry Bustamente

ps. pardon the absence of left and right carrots in the syntax. When I tried to submit this question I received,

"FYI We cannot post your topic because the subject contains < or >. Subjects may not contain this combination of those characters. Use your back button to try again."
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Notice that param tag is nested inside include tag. Also the attribute color is an array type so we can assign as many values as we want to it.

Therefore the values inside param are parameters to included page.
Jerry Bustamente
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thank you so much for your considerate reply. I understand now.


Jerry Bustamente
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!