If there is no person bean in request scope than the code inside <jsp:useBean tag executed(<jsp:setProperty) and it first create a new person bean in the request scope then set its name property to Fred
However on the other hand, if there is a person bean in the request scope ><jsp:setProperty is not
So this means ><jsp:setProperty works conditionally based on person bean existence in the scope which you defined in <jsp:userBean tag.
To conclude, if you use a body in <jsp:useBean than the bean existence is important for the behaivor of tag inside <jsp:useBean.
If person bean dosen't exits then only <jsp:setProperty> tag executes and repleces the existing property. But by the example mention above it sets the person bean in the request scope, so <jsp:setProperty> not executes..
But if you use <jsp:getProperty> which is not inside the <jsp:useBean> tag (not based on condition) it executes and get you the value of the mention property, in this case value of name property, if it got some value. means existing value of the name property.
Hope this help you
Thanks <br />Poonam Agarwal SCWCD 86%
Joined: Mar 15, 2007
yes i got it.. based on the above example,see it has bean object set in request scope so setProperty doesnt not execute ,getProerty will give the value of name.. in this case it has no value it will be null.