Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ELException

 
amarkirt saroay
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having an attribute in the request scope (request.setAttribute("val1","66")) and I want to print it using pagecontext implicit variable.since HttpServletRequest has a method getAttribute() ,so I thought this would work but

I am getting this ELException:
javax.servlet.jsp.el.ELException: Unable to find a value for "attribute" in object of class "org.apache.catalina.core.ApplicationHttpRequest" using operator "."
when i try to execute this code in my jsp :

<cut value="${pageContext.request.attribute.val1}"/>
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The pageContext implicit object is of type javax.servlet.jsp.PageContext. There is a getRequest() method, so ${pageContext.request} is fine. It returns a ServletRequest instance. However, look at the javax.servlet.ServletRequest API. There is no getAttribute() which takes no argument. So ${pageContext.request.attribute} will fail. If you want to retrieve an attribute from the request yuo can either :
  • Use the requestScope implicit object : ${requestScope.val1}
  • Or let the container find it : ${val1}
  •  
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic