• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why does ${pageContext. ServletConfig . servletName} work?????

 
Tim Zhou
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am studying for the SCWCD exam and I was wondering why this EL expression worked.

${pageContext . ServletConfig . servletName}

Because the pageContext implicit object is not an array map or list, and neither is the ServletConfig object. I did notice that the pageContext implicit object had a getServletConfig() method. is there something that I'm missing here? what is the exact mechanical process by which the servletName attribute is obtained??
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is happening because ServletConfig appears (to EL) to be a JavaBean, providing getXxx() methods. Invoking any xxx property on a JavaBean using EL will call that JavaBean's method.

So in this case, pageContext.servletConfig actually means pageContext.getServletConfig() and pageContext.servletConfig.servletName actually means pageContext.getServletConfig().getServletName().
 
Tim Zhou
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thats very helpful, thanks Charles
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic