furthermore I did manage to solve the problem according to the replies to my post:
<h:outputText value="#{user.phone}" rendered="#{user.class.name eq 'com.dp.data.Customer'}"/>
<h:outputText value="---" rendered="#{user.class.name ne 'com.dp.data.Customer'}"/>
I still thing this is a very dirty hack, and I find it count-intuitive that logical expressions in jsp2.0 / jstl are different from JSF expressions i.e.:
${!empty user.phone} and #{!empty user.phone} behave differently.....
regards....
Peter
On 11/25/05, Martin Marinschek <[EMAIL PROTECTED]> wrote:
The value should not be evaluated when rendered evaluates to "false".
regards,
Martin
On 11/25/05, Peter Maas <[EMAIL PROTECTED]> wrote:
> Well,
>
> I referenced the 'missing' property in the scripting in the test for
> determining visibility as well.... didn't test putting
> 'false' in there directly.... I might try that later today.... I'll let you
> know!
>
> -P
>
>
> On 11/25/05, Simon Kitching <[EMAIL PROTECTED]> wrote:
> > 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
> >
>
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces

