• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Question in setProperty action

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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"/>



Yes, it will reset whether or not the bean existed or created just now because it was not found in the specified scope.

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.



You are right. The setProperty will not the invoked only if you nest it inside the <jsp:useBean> tag. My above answer answers this question.

For ex:
If "test" bean had existed before, then the <jsp:setProperty> will not be invoked only if you code like this:



Not when you code like this:


Hope this helps,
Srikanth
[ November 24, 2006: Message edited by: Srikanth Raghavan ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic