• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:param has higher preceedence ! :)

 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the outcome of making the HTTP GET request shown to params.jsp (source follows)? (Choose one.)

The HTTP request is in this form:
http://localhost:8080/examp0702/params.jsp?X=1&Y=2&Z=3

Source of params.jsp:


Source of included.jsp:



now my concern is - that the answer is 4 6 451 1 2
i was puzzled by the order 451, and i thought that the parameters passed to the included.jsp using jsp aram enjoy preceedence over the request parameters. so inside included.jsp, the areay will hold 4,5,1 in that order.

i cross checked this with jsp spec, and felt nice that it too conformed the same !
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a bit puzzled. You're saying answer is 451, and you were expecting 451. Where is the problem ?
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was expecting 1,5,4
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i was expecting 5,4,1 !
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand what you mean
--> 1
--> 4, 1
--> 5, 4, 1

It is also written to refer to "SRV.8.1.1".
There, it is written that Parameters specified in the query string used to create the RequestDispatcher take precedence over other parameters of the same name passed to the included servlet..
So now we are left wondering what's the actual order for request parameters. Looking at "SRV.4.1 HTTP Protocol Parameters", it says :
if a request is made with a query string of a=hello and a post body of
a=goodbye&a=world, the resulting parameter set would be ordered a=(hello,
goodbye, world).


So we may deduce that the result of the question is 4,5,1.

Anyway, that's unclear And I don't think you'll get such tricky question at the exam.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic