• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EL Expresion of request URI

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Amol for your timely response.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic