Hello Nick,
In this case what would be my, where should I define
it? I haven't used facelets before, could you mind
explaining it to me?
Thanks a lot,
Johnny
--- "Hagen, Nicholas" <[EMAIL PROTECTED]> escribió:
> There may be other better solutions, but if you are
> using Facelets the one
> thing I have done in those situations is using an EL
> function such as:
>
> <h:outputText value="#{my:datavalue(document,
> 'name', 'Default Value')}" />
>
> Then, define the my:datavalue function in the tag
> library and have a static
> method such as:
>
> class Utils
> {
> public static String getDatavalue(Object o, String
> prop, String def)
> {
> // Use Property Utils, Bean Utils, etc to check if
> prop is
> // is on object 'o' and if so, return
> it...otherwise,
> // just return the def value...or just check if
> 'o' is
> // instanceof some object and then use reflection
> to get
> // the prop method and value
> }
> }
>
> Nick
>
> -----Original Message-----
> From: Johnny Gonzalez
> [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 29, 2006 8:33 AM
> To: MyFaces Discussion
> Subject: instanceof into a c:test to select
> datatable column value??
>
> Hello everybody,
>
> I have a big problem,..
>
> I have a JSF data table which can have several types
> of objects, some have an attribute called name
> others
> don't, so I need to have a conditional that
> depending
> on the kind of object to show the name (if they have
> it) or to show a specific string for example:
> ("Doesn't have"), so I tried this:
>
> <c:choose>
>
> <c:when test="#{null == document.name}">
>
> <h:outputText value="Doesn't have"/>
>
> </c:when>
>
> <c:otherwise>
>
> <h:outputText value="#{document.name}"/>
>
> </c:otherwise>
> </c:choose>
>
>
>
>
> But this pulls me a message in console with
> something
> like:
>
>
> javax.faces.el.PropertyNotFoundException: Bean:
> co.com.company.bo.document.MasiveDocumentBO,
> property:
> name
>
>
>
> What should I do?
>
> All objects inherits from a class DocumentBO which
> has
> all common attributes, inheriting from that class I
> have:
> MasiveDocumentBO
> InternDocumentBO
> ExternDocumentBO
>
> The first class doesn't have that attribute, what
> should I do?
>
> Thanks a lot
>
>
>
> ______________________________________________
> LLama Gratis a cualquier PC del Mundo.
> Llamadas a fijos y móviles desde 1 céntimo por
> minuto.
> http://es.voice.yahoo.com
>
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com