Whats the difference between JSP implicit object and EL expression implicit object?
I have started reading JSP. I came across JSP implicit object, say for 开发者_如何学编程example, session
, application
etc. And after reading EL expression, i came to know there are also implicit object for EL expression.
My question is what is the difference between these implicit objects?
Even though they are semantically the same, why does they create EL and makes thing's little bit hard?
Correct me if am wrong
There isn't any difference in the object that you're getting, it's just different ways of accessing the same objects in each of the technologies. For example, request
in a JSP will give you the same object as ${pageContext.request}
in EL.
In the case of EL, additional implicit objects are available for convenience, such as param
or requestScope
. You could still get the same data, but the syntax would be clumsy.
You might wish to compare this to implicit objects in a JSP vs. a 'lack' of implicit objects in Servlets. JSP implicit objects are not different from the objects that you can get a hold of in a Servlet, it's just that the implicit objects make for cleaner syntax. For example, the implicit session
object is the same that you would get via HttpServletRequest#getSession()
. An exception to this is the pageContext
which has no equivalent in Servlets.
精彩评论