I have a select:
<h:selectOneMenu id="treeNode" label="#{msgs.treeNode}" value="#{treeNode}">
<f:selectItems value="#{treeItems}" />
</h:selectOneMenu>
which uses these selectItems:
List<SelectItem> treeItems = new ArrayList<SelectItem>();
treeItems.add(new SelectItem("1", "Parent"));
treeItems.add(new SelectItem("2", " Child 0 0"));
treeItems.add(new SelectItem("2", " Child 0 0 0"));
treeItems.add(new SelectItem("2", " Child 0 0 1"));
treeItems.add(new SelectItem("2", " Child 0 1"));
My problem is that the output in the select should look like a tree, but since the whitspaces are gone I have a “flat”-view.
Is there a way how I could convert the whitspaces into a nonbreakable-space?
Thanks
Jonny
Just replace them by
yourself and set theescapeattribute tofalse. It’s the 5th argument of theSelectItemconstructor.