Can anybody tell me what is the exact meaning of type and class attributes of jsp:usebean
tag.?
I am getting an exception InstantiationException while using them in my application.
An extract from docs,
The jsp:useBean element declares that the page will use a bean that is stored within and is accessible from the specified scope, which can be application, session, request, or page. If no such bean exists, the statement creates the bean and stores it as an attribute of the scope object .
The value of the id attribute
determines the name of the bean in the scope and the identifier used to reference the bean in EL expressions, other JSP elements, and scripting expressions .
The value supplied for the class attribute
must be a fully qualified class name. Note that beans cannot be in the unnamed package. Thus the format of the value must be package-name.class-name.
Instantiation Exception is thrown on many scenarios, basically when you dont specify the required values for the attributes of the useBean
tag.
See also