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

Include param

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the contents of two JSP files:
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?
(Select one)
http://localhost:8080/chapter13/this.jsp?color=blue
a blue
b red green
c red green blue
d blue red green
e blue green red
Answer: c
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.


HFSJ Doesn't Talk about this ???
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(you can turn of smilies by checking the "Disable smilies in this post." at the bottom left of the screen when you post)
 
Shruthi Karthick
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nope...
order of request parameters is not mentioned in first edition....
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As this info is missing from HFSJ. Can we safely say that this won't be in the exam ?

Once again i am trying to figure out do i need to study something extra (other than HFSJ)...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic