This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

/jsp:include SCWCD Exam Study Kit  RSS feed

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

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" /
/jsp:include
/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?

http:/localhost:8080/chapter13/this.jsp?color=blue

The answer is: red green blue

Explanation

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.
Thanks
Imad
 
Jerry Bustamente
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muhammad,

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

Sincerely,

Jerry Bustamente
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!