You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Yaron Spektor <ya...@b6systems.com> on 2007/03/07 06:47:08 UTC

from components to JSF tags

Hi,

Does anyone know a way in which I could see my JSF components as JSF
tags?

I am creating the components programmatically and would like to view the
JSF tags before or after they are rendered to the screen.

 

Thanks,

Yaron


Re: from components to JSF tags

Posted by Volker Weber <v....@inexso.de>.
Hi,

> I don't know of any existing code to walk that tree and print out the
> data in a useful format but it would be about 10 minutes work to write

here is one:
http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java?view=markup

the "public static String toString(UIComponent component, int offset);" method
at line 553 today

Regards,
  Volker

Re: from components to JSF tags

Posted by Simon Kitching <si...@rhe.co.nz>.
Yaron Spektor wrote:
> Hi,
> 
> Does anyone know a way in which I could see my JSF components as JSF tags?
> 
> I am creating the components programmatically and would like to view the 
> JSF tags before or after they are rendered to the screen.

I don't understand what you are looking for here.

If you've created the components programatically then you have a tree of 
UIComponent objects, but no "tags" are involved at all.

You can display the component tree by writing some simple code to walk 
the tree:
* FacesContext.getCurrentInstance().getViewRoot() will return the "top 
node" of the component tree
* component.getChildren() returns a list of child nodes of a component.

I don't know of any existing code to walk that tree and print out the 
data in a useful format but it would be about 10 minutes work to write 
it. If this were called from a PhaseListener then it might be a useful 
debugging tool.

Catagay's FacesTrace tools might also be useful for you:
  http://sourceforge.net/projects/facestrace/

Regards,

Simon