hi ,
I don't know i got you completly or not, still trying to clear it .....
<jsp:useBean> have two forms .
1)
<jsp:useBean id="user" class="mypack.User"/>
<jsp:setProperty name="user" property="name"/>
2)
<jsp:useBean id="user" class="mypack.User">
<jsp:setProperty name="user" property="name"/>
<jsp:useBean/>
In the 1st case if the bean object is not there container will create an bean object and will set it's
name property .
If the bean object is there then also the container will set it's name property .
But in second case if the bean object is not there container will create an bean object and will set it's
name property .
But if the bean object is there then body of the <jsp:useBean> is not executed . So now the bean will have the previously set values .
when we use the <jsp:useBean> tag with a body, the value for the beans property will be set only if the bean does not have a value already set.
So this is not always true as i explained previously .
So, setProperty is like giving a default value to the bean, if it is not set. Am I right??
You can said that . Thing is that bean specification says that in side bean constructor we shouldn't do anything (i mean setting any property ). Bean should have diferent public setter method for setting it's property .
Thus for setting the bean property we are invoking <jsp:setBean > tag .
If you are still not clear reply back .....
with regards
Arunabh