This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
at the time the <jsp:setProperty name="b" property="p" value="new"/> is executed, there exist two beans named b. One in request scope the other in session scope.
setProperty tag does not accept scope attribute so it starts to search through all scopes starting with page scope, then request scope and so on. It sets the property of the first bean found.
In your example it sets the "new" value to the bean in the request scope so the bean in session scope is left uninitialized.
[ January 08, 2007: Message edited by: Jasiek Motyka ] [ January 09, 2007: Message edited by: Jasiek Motyka ]
Joined: Nov 10, 2006
i also tried out myself, in short,
- set/getAttribute methods: always scoped - jsp:useBean: always scoped - jsp:set/getProperty: scope order from request, session and likewards - EL bean without scope prefix, scope order from request, session and likewards - EL bean with scope prefix, always scoped