Peter Maas wrote:
I'm fully aware of the introspection/reflection api's in the sdk, but
this is not what I want, at least I hoped some support for
OO/Inheritance would be availlable in JSF

You want to be able to handle someone providing an instance of a base class when a particular subclass was really expected. That's not good OO design, and not supporting it isn't a flaw in JSF in my opinion.


in plain java the problem wouldn't even need reflection/introspection!
I would be able to just use the instanceof operator in an if-statement
and cast the object to the needed type

in jstl this is also not a problem either:

${!empty bean.method}

will not fail is the bean doesn't have the requested property, this
counts as 'empty'

If so, I would regard that as very poor design in jstl. A method that doesn't exist is not "empty"; it's an error. Any use of "instanceof" is a warning sign of incorrect OO design.

I don't mean to be critical of your code; I'm just pointing out that JSF not handling this elegantly isn't a problem with JSF as far as I am concerned.


So, in your opinion, the only way to solve this problem would be:

write a custom component for rendering text which encapsulates the
exeption thrown by invocating a non-existent method (or tests if the
method is callable or not, which in most cases would be less
efficient) ....?


Someone suggested earlier doing:
  <h:outputText value="#{...}" rendered="#{.....}"/>
You indicated that this didn't work because the value expression was evaluated even when the rendered expression was false.

I'm a bit surprised by that; I would have expected value to be ignored when the component isn't rendered. Making this happen would also solve your problem wouldn't it?

Does anyone know why the value would be evaluated when rendered is false?

Regards,

Simon

Reply via email to