• Post Reply Bookmark Topic Watch Topic
  • New Topic

pageContext in EL

 
tong yuxin
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think the pageContext can get any implicited object of jsp,

I try ${pageContext.request.requestURL} it works well.

now, i store a bean "address" with property "street" in request scope,

and when i try ${pageContext.request.attribute["street"]} it throws exception?

so what happened?

I know ${requestScope.address.street} , ${address.street} and ${address["street"]} all can get the property value.

But Can i use the pageContext to get the property value?

Thanks for any help
 
Marimuthu Madasamy
Ranch Hand
Posts: 72
Java Monad Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
${pageContext.request.attribute["street"]} it throws exception?


Since the class to which 'request' belongs has no getter method named 'getAttribute' (following Java Bean convention). (request is-not-a 'Map' also)
[ October 15, 2008: Message edited by: Marimuthu Madasamy ]
 
tong yuxin
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry,
but i think the request has
getAttribute(String){} and
setAttribute(String object){}

and if request is not map or bean why i can get
${pageContext.request.method}?
 
Marimuthu Madasamy
Ranch Hand
Posts: 72
Java Monad Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HttpServletRequest ('request' type) has a method named 'getMethod'. In fact, you can invoke all the getter methods (that follow Java Beans convention) of HttpServletRequest.

One important thing that i forgot to tell you in my previous reply,

The getter methods of the objects should follow Java Beans convention (it should not accept any arguments).
[ October 15, 2008: Message edited by: Marimuthu Madasamy ]
 
tong yuxin
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
o!!!

Thanks !!! DUDE

I am sucks !!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!