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

EL Expresion of request URI

 
PRavi kumar
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which El Expresion eveluates to RequestURI
a){requestURI}
b){request.URI}
c){request.getURI}
d){request.requestURI}
e){requestScope.requestURI}
f){pageContext.request.requestURI}
g){requestScope.request.requestURI}

what is the correct answer. I seled the answer is F.

Kindly explain
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are correct.

The only bothering should be ${requestScope.requestUTI}
But that any way contains only attributes set. Not parameters.

For URI and queryString we should go for ${pageContext.request.requestURI}
${pageContext.request.queryString}

Yes Amol, I have corrected my post.

For parameters,
1. request parameters: param, paramValues
2. context init parameter: initParam


[ August 13, 2007: Message edited by: Srinivasan thoyyeti ]
 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Srinivasan,
But, there are no parameter attribute in the second expression you mentioned? Can you ellaborate on this?
With regards,
Padma priya N.G.
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Srinivasan wrote:
The only bothering should be ${requestScope.requestUTI}
But that any way contains only attributes set. Not parameters.

For parameters we should go for ${pageContext.request.requestURI}


For parameters you should use param,paramValues.

Here the explanation would be, requestScope is a map of the attributes in the requestScope and not the ServletRequest Object itself.

To access it you need to do pageContext.request (as PageContext has a method
getRequest) then use requestURI to get the requested URI.
 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amol,
But, there is no usage of getrequest() method here?
With regards,
Padma priya N.G.
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amol,

Thanks for the correction.

JSP can have init-parameter na. How to access them through EL.

<serlvet>
<servlet-name>sample</servet-name>
<jsp-file>/processView.jsp</jsp-file>
<init-param>
<param-name>language</param-name>
<param-value>Java</param-value>
</init-param>
</servlet>
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Srinivasan wrote:
JSP can have init-parameter na. How to access them through EL.


There is an initParam in EL, but watch out and dont fall for it, it is
the context param.

There is no direct way to do this.
One way is to create a map of init params from the servlet and store in
a scope say request. Then access this map from the jsp to get the value.
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Amol for your timely response.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic