• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Include param

 
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 ???
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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)
 
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)...
 
This tiny ad is suggesting that maybe she should go play in traffic.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic