Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubts in EL from HFSJ  RSS feed

 
Dash Abhisek
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
${pageContext.request.method}

I decoded it as pageContext is an object of a bean class which has a property 'request' so pageContext.request will return me a request object
but this request object is not a object representing a bean or map.so,
the left side of 'method' is not a bean or map so these expression should be wrong.
I know I am wrong somewhere can you please point it out so,that I can improve my understanding in EL

one more doubt
${cookie.username.value}

why not we just write ${cookie.username}? ,cookie is the object of a map
which has key value pairs one of the key is "username" and it has some value so, we should be using ${cookie.username} and it should give me the value ,why we are using the extra '.value'

Thanks in advance,
Abhisek
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The request object has methods that follow the bean naming convention so EL can access them.

In this case you're calling the getMethod() method.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletRequest.html#getMethod()
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dash Abhisek:
but this request object is not a object representing a bean or map
What made you conclude that? As Ben pointed out, the request object has properties that can be obtained via the EL.

With regards to the cookie question, again do some investigation. What does ${cookie.whatever} return? You seem to have concluded that it's the string value of the cookie. Verify what is does return.
[ November 20, 2008: Message edited by: Bear Bibeault ]
 
Dash Abhisek
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I did a simple application and I found ${cookie.username} returned me the cookie object so,obviously I have to add ".value" to get the value.
so, the thing is that the key maps to the cookie object not the value.

Thanks
Abhisek
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!