Hi all,
With SCWCD exam only 5 days away, I'm doing my final round-up. I have a doubt about the internal working of jsp:usebean when type and class is used.
Now, according to HFSJ, when i put this on my JSP:
the generated code in _jspService is this (package names excluded):
Now, given that:
- Person is an abstract class with attribute "name"
- Employee is a non-abstract subclass of Person with attribute "empID"
Now I call my JSP with following query string:
Tomcat uses introspection to set the properties, and thus both name AND empID are set, even though the type in the _jspService method is the abstract Person that has no empID attribute. In other words: without introspection, this would never work.
My question is: can I rely on this behaviour? Will this always work? Or can/will there be containers that use the regular attribute setter and thus not be able to set the empID property?
Thanks in advance,
Matthias
[ November 12, 2008: Message edited by: Matthias De Scheerder ]
With SCWCD exam only 5 days away, I'm doing my final round-up. I have a doubt about the internal working of jsp:usebean when type and class is used.
Now, according to HFSJ, when i put this on my JSP:
the generated code in _jspService is this (package names excluded):
Now, given that:
- Person is an abstract class with attribute "name"
- Employee is a non-abstract subclass of Person with attribute "empID"
Now I call my JSP with following query string:
Tomcat uses introspection to set the properties, and thus both name AND empID are set, even though the type in the _jspService method is the abstract Person that has no empID attribute. In other words: without introspection, this would never work.
My question is: can I rely on this behaviour? Will this always work? Or can/will there be containers that use the regular attribute setter and thus not be able to set the empID property?
Thanks in advance,
Matthias
[ November 12, 2008: Message edited by: Matthias De Scheerder ]