• Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing userPrincipal via EL - why doesn't this work?

 
Edward Winchester
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I can print out the principal like this:


This doesn't work:


But this does:


Can someone explain why the 2nd doesn't work please?

Thanks,

Ed
 
avi sinha
Ranch Hand
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
request is not an implicit object for El that's why it is happening. you can access the actual jsp implicit object reference "request" using pageContext.request
and userPrinciple is a property of request here
avi sinha
 
Edward Winchester
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
avi sinha wrote: request is not an implicit object for El that's why it is happening. you can access the actual jsp implicit object reference "request" using pageContext.request
and userPrinciple is a property of request here
avi sinha

Thank you. I continually get confused with the different methods.
 
anand chouti
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<cut value="${requestScope.userPrincipal}"/>
whenever we use attributes from request or session, EL uses requestScope or sessionScope to map the same. The above EL expression should work
 
Edward Winchester
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anand chouti wrote: <cut value="${requestScope.userPrincipal}"/>
whenever we use attributes from request or session, EL uses requestScope or sessionScope to map the same. The above EL expression should work

Actually, it doesn't work. I tried it before you posted. I was going to ask why but thought I'd plough through the docs instead. Now we're on the topic, anyone know why?

Thanks,

Ed
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anand chouti wrote: <cut value="${requestScope.userPrincipal}"/>
whenever we use attributes from request or session, EL uses requestScope or sessionScope to map the same. The above EL expression should work

Nonsense. Request scope and the request instance are not the same thing.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!