Originally posted by Garann Rose Means:
When a page uses <jsp:useBean>, when does the bean get instantiated? At that line?
Yes, the bean gets created at the point where the useBean tag occurs, provided
a) The bean with the specified id is not already present in the specified scope and
b) Either the class attribute or the beanName attribute is provided
Originally posted by Garann Rose Means:
I am trying to use an overloaded constructor to set instance variables from the constructor. Am I allowed to do that with a bean, or will I need to call setters in the bean class?
useBean action uses the default constructor. But you can initialize a newly created bean either by using the setter methods in a scriptlet or by using the setProperty action within the body of the useBean action
<jsp:useBean id="aBean" class="MyBeanClass">
<jsp:setProperty name="aBean" property="aProperty" value="aValue"/>
</jsp:useBean>
For a detailed explanation of the useBean, setProperty & getProperty actions, have a look at the sample chapter at
http://www.manning.com/deshmukh/chap14.pdf Initialization is explained in section "Initializing bean properties" on page 262
HTH
-j