How does the JSP engine instantiate the bean ? Is it mandatory to have no args constructor ? what exactly is scope ?
posted 14 years ago
Hi, The Javabean API requires a class to have a no args constructor. This is so the system is able to instantiate the bean using the instantiate() method found in the java.beans.Beans package. I assume the jsp engine uses the same method to instantiate the bean though I'm not positive. But Yes, it is mandatory to have no args constructor scope, as I understand it, refers to an object which holds attrubutes. Each attribute has a unique identifying name linked to an object. A javabean would be such an attribute. There are 4 kinds of scope, indicating how much access there is to the bean. for example, a bean with page scope is only visible and accessable by the jsp page which contains it. a bean with request scope is visible to the page which contains it as well as any jsp or servlet the page is forwarded to. Session scope indicaties a bean is visible to all jsps and servlets which are part of the same session and application scope means the bean is available to all jsps and servlets in the entire web application... I think
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads