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.
i found this behaviour a bit odd - given a bean in the request scope set like this in a servlet:
and a view like this:
and a call like
i am not really sure why i should expect the setProperty to be called and the output "pooh". there surely is an object of reference type Person in the request. and as Person is abstract, it can't be instantiated : without a class attribute, there's no way for the Container to do it! so it looks to me like the setProp is being called although the bean already exists.
i can see the (WAS 5.1) generated code looking like this:
anyone help here? (i dont have tomcat installed on this client or i'd test it outside my local WAS environment)
According to the specs, the body of the jsp:useBean should not be invoked because the foo.Person object has already been created (and if it isn't when it gets to jsp:useBean, an exception will be thrown). I would try the code under Tomcat, because if you can guarantee that eveything is as it should be, then the jsp:setProperty standard action should not be reached.
SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJD, SCEA/OCMJEA
Live life to an interface, not an implementation!
peter john greaves
Joined: Jan 12, 2006
well, well. under tomcat (5.5) i get the expected output "bertie" : IOW the setter isnt called. think i'll stick with tc for my tests. thanks for the reply!