Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question in setProperty action

 
aanal jethalia
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

If we have a useBean, with say id="test", and the test bean exists in the default scope, I know that having setProperty in this action's body will not be invoked.

How does the setProperty action behave when this action (for useBean test) is put outside the useBean body? Will it reset the earlier value with the new one?

as in how would the following code work?
<jsp:useBean id="test" class="someClass"/>
<jsp:setProperty name="test" property="testProp" value="some value"/>

I hope I made my question clear.
Thanks
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we have a useBean, with say id="test", and the test bean exists in the default scope, I know that having setProperty in this action's body will not be invoked.

How does the setProperty action behave when this action (for useBean test) is put outside the useBean body? Will it reset the earlier value with the new one?

as in how would the following code work?
<jsp:useBean id="test" class="someClass"/>
<jsp:setProperty name="test" property="testProp" value="some value"/>


there are two cases -

1. jsp:useBean with a body -
the code inside the body runs only if a new bean is created
2 jsp:useBean without a body -
if you use the jsp:SetProperty outside the body, it will definitely
reset the previoud value of the bean's property.
hth
Also note that it is pointless to use a jsp:useBean with only a "type" attribute, and a body that sets the property values.

hth
 
aanal jethalia
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Niranjan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic