Q: How to add a Line Break for label in of f:selectItems I am usin SelectOneMenu, in which the selectItems will load from database. The labele values are very large to fit in browser, So i wanted to split the label into multiple lines. Please let me know wether it is Possibe.
I have added a line break ('\n') in the label text. still it did not work
String description = "22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222";
        StringBuilder sb = new StringBuilder();
        String[] split = description.split("(?<=\\G.................................................)");
        for(String s : split){
            sb.append(s).append("\n");
        }


A: The element <h:selectOneMenu> is translated into a <select> HTML element while <f:selectItem> and <f:selectItems> are translated into <option> HTML elements.
Browsers don't manage line-break in these elements. See : Line Break in HTML Select Option?
As stated, the only method is to create custom HTML and use JS to make it look like a native <select>
