• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is it possible to retrieve request parameters through pageContext ?

 
Aj Deschanel
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to retrieve request parameters using pageContext.request ? ?
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, But, are you using scriptlets in JSP?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abimaran Kugathasan wrote:Yes

Actually, no.

That is, assuming that the poster is asking about EL expressions. Remember that the EL can only access bean properties, so there's no way to call the getParameter() method in a scriptless JSP page.

The appropriate way to access request parameters in an EL expression is to use the param or paramValues implicit scoped variables.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Hijack removed. Ask your own questions in your own topics please.]
 
Harpreet Singh janda
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Implicit scoped variables are actually Maps. you have to pass the name of the "parameter" that you want to access and it will return the value of the parameter. paramValues will return an array of values and param will return the single value corresponding to the passed "Parameter Name"
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
That is, assuming that the poster is asking about EL expressions. Remember that the EL can only access bean properties, so there's no way to call the getParameter() method in a scriptless JSP page.


Can't we conside request as a bean? Here, below, we can access the request with the EL..
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abimaran Kugathasan wrote:Can't we conside request as a bean? Here, below, we can access the request with the EL..

Yes, you can access bean-patterned properties from the request. Parameters are not bean-patterned. Use the implicit scoped variables as intended.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Parameters are not bean-patterned. Use the implicit scoped variables as intended.

Thanks Bear!
But, what about this?
Isn't it a bean-patterned?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the javadocs for the signature of the method and answer your own question.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I missed there, it {getParameter(str : String)} has as argument! So, not bean-related pattern! Thanks Bear!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!