Hi Greg,

why don't you set the ESCAPE_ATTR to false, as indicated by the
code-snippet? You'll have to set the corresponding attribute of the
selectOneMenu component that contains your select-item. You can do
that easily by using component-binding:

<h:selectOneMenu ... binding="#{myBean.specialComp}"/>

public class MyBean
{
  public HtmlSelectOneMenu getSpecialComp()
  {
    HtmlSelectOneMenu menu = new HtmlSelectOneMenu();
    menu.getAttributes().put(JSFAttr.ESCAPE_ATTR,false);
    return menu;
 }
}

By the way - there is no SelectItemRenderer - the select-items are
rendered by the component they are contained in.

regards,

Martin

On 10/24/06, Greg Reddin <[EMAIL PROTECTED]> wrote:
I have a situation where I *think* the solution is to write a custom
renderer.  It has brought up some issues with renderers I wanted to
ask about as well.  Here's my problem:

I need to display a combo box with "hierarchical" select items.  IOW,
the list of items in the combo box needs to be displayed as a tree
like follows:

Item 1
    Item 2
    Item 3
Item 4
    Item 5
        Item 6
etc....

I tried to do this with &nbsp; in the itemLabel property of the
SelectItem and the renderer deleted the &nbsp;'s.  I stepped through
the code and found the following in
HtmlRendererUtils.renderSelectOptions():

                if (component instanceof EscapeCapable) {
                    escape = ((EscapeCapable) component).isEscape();
                }
                else {
                    escape =
RendererUtils.getBooleanAttribute(component, JSFAttr.ESCAPE_ATTR,
                                                               true);
//default is to escape
                }

If I import that source file into my codebase and comment out the
above snippet everything works beautifully.  So I thought maybe I
should just write a custom SelectItem renderer and use that.  But this
code is in a static method of a utility class.  I don't want a custom
renderer, I just want a custom implementation of this particular
method.  Is there a better way to customize this?  Or is there a way
to override the utility class with my own implementation?

Thanks,
Greg



--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to