0

I'm making xhtml page with master-detail view pattern. In master panel I use tree component from PrimeFaces. Name of child branch must contain 4 nonbreaking space as a divider of brand, colour and year and use tag for type attribute. I use tag with concatenation String in value. Is it possible to use tag in JSF and more than one nonbreaking space in value ? Because all spaces are eliminated automatically.

fragment of home.xhtml

<p:tree id="tree1" value="#{treeDNDView.root1}" var="node" .... >
    <p:treeNode>
        <h:outputText value="#{node}"/>
    </p:treeNode>
</p:tree>

fragment of Car.java

@Override public String toString() {
    String result = "";
    if(year != "")
        result += " brand" + brand + "    ";
    if(color != "")
        result += " color" + color + "    ";
    if(year != "")
        result += " year" + year;
    return result;
}

fragment of DragDropView.java

@ManagedBean(name="treeDNDView")
@ViewScoped
public class DragDropView implements Serializable  {
    private TreeNode root1;
    private String year;
    private String color;
    private String brand;
    // setters getters
    @PostConstruct
    public void init() {
        root1 = new DefaultTreeNode(new Car("Transport", "", "", ""), null);
        TreeNode cabrio1 = new DefaultTreeNode(new Car("004", "1991", "Red", "Toyota"), root1);}

Output example: brand Toyota color Red year 1991

Need: brand Toyota (4 spaces) color Red (4 spaces) year 1991

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Vadim
  • 557
  • 8
  • 21
  • use ` ` instead of `' '` in HTML and read about HTML entities ;-) – Betlista Feb 12 '18 at 09:35
  • Reed about html and multiple species in general. Then read how to solve that and 'port' that to jsf. Lots and lots of info on this in Google and Stackoverflow – Kukeltje Feb 12 '18 at 09:37
  • Possible duplicate of [Replace spaces with nonbreakable spaces in JSF](https://stackoverflow.com/questions/30239497/replace-spaces-with-nonbreakable-spaces-in-jsf) – Jasper de Vries Feb 12 '18 at 12:43

0 Answers0