You want to locate an existing bean object but do not want to create a new instance, if an existing instance is not available. Which of the following bean attributes will you use in the jsp:useBean action?
-
class
-
type
-
beanName
-
class and type
-
beanName and type
B
Correct answer
Explanation
When you use only the type attribute in jsp:useBean (without class or beanName), the container will look for an existing bean with the specified scope and type. If no existing bean is found, no new instance is created. This prevents instantiation when you only want to reference existing beans.