In a JSP page, there is such code:
<jsp:useBean id="checklog" class="com.google.admin.guard.CheckLogBean" scope="session" />
and then
<% checklog.checkit(); %>
Why we don’t just create the object with new com.google.admin.guard.CheckLogBean?
What’s the benefit of doing this?
And in the source code, there is no such class, but when we deploy it to server, it works. It seems that the server can pass the class to it?
Thanks.
The Jsp bean classes (.class) must be placed under
WEB-INF/classesfolder or if they packaged into .jar, put.jarfiles intoWEB-INF/lib.jsp:useBeanis an action to instantiate a bean declaratively and with different scopes (session,request, application, and page). Another feature of Bean is The magic of introspection – Java manages this little miracle though a process called introspection that allows a class to expose its methods and capabilities on request.JavaBeans Components in JSP Pages