myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hagen, Nicholas" <NHa...@trane.com>
Subject RE: instanceof into a c:test to select datatable column value??
Date Thu, 29 Jun 2006 14:17:29 GMT
For information on Facelets, see:
https://facelets.dev.java.net/nonav/docs/dev/docbook.html

As for the "my", it is the prefix for the namespace of the tag library.
Similar to when defining a custom tag in JSP, you have a namespace and
prefix assigned to the tag.  In the case of Facelets, you would have to
define a tag library with some particular namespace of your choosing, then
define the prefix (of your choosing...I just chose "my" for the sake of an
example) in the actual page itself that maps to that same namespace (done
using xmlns XML syntax for the case of Facelets).  Facelets has its own
mailing lists that may be beneficial to ask questions to directed at
Facelets if you went down that route....however, as stated prior, I would
think there is possibly an easier way to handle what you are doing w/o using
custom EL functions...I will leave those solutions up to the MyFaces
developers to answer :)  Just figured I would share what I have done in the
past.

Nick

-----Original Message-----
From: Johnny Gonzalez [mailto:johnnygonzalezl@yahoo.es] 
Sent: Thursday, June 29, 2006 8:56 AM
To: MyFaces Discussion
Subject: RE: instanceof into a c:test to select datatable column value??

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" <NHagen@trane.com> 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:johnnygonzalezl@yahoo.es] 
> 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

Mime
View raw message