0

我需要获得类似的内容

 <script type="text/vnd.graphviz" id="genealogy">
      digraph genealogy {
           ratio="auto";
           rankdir="BT";
           edge [style=solid arrowhead=none arrowtail=normal ];
           node [color=lightblue style=filled shape=box ];
           "118" [label="Max Mustermann"];
           "812" -> "118" [];
           "812" [label="Luise Mustermann"];
      };
 </script>

但不幸的是

 <h:outputScript id="genealogy">
      digraph genealogy {
           ratio="auto";
           rankdir="BT";
           edge [style=solid arrowhead=none arrowtail=normal ];
           node [color=lightblue style=filled shape=box ];
           "118" [label="Max Mustermann"];
           "812" -> "118" [];
           "812" [label="Luise Mustermann"];
      };                    
 </h:outputScript>

只是给我

 <script type="text/javascript">
      digraph genealogy {
           ratio="auto";
           rankdir="BT";
           edge [style=solid arrowhead=none arrowtail=normal ];
           node [color=lightblue style=filled shape=box ];
           "118" [label="Max Mustermann"];
           "812" -> "118" [];
           "812" [label="Luise Mustermann"];
      };                    
 </script>

所以我的问题是:如何将 id="genealogy"(和 type="text/vnd.graphviz")放入 -Tag?

4

1 回答 1

0

从源头来看,type="text/javascript"是硬编码的,因此您将无法使用h:outputScript标签进行操作。

@Override
protected void startElement(ResponseWriter writer, UIComponent component) throws IOException {
    writer.startElement("script", component);
    writer.writeAttribute("type", "text/javascript", "type");
}

来自ScriptRenderer.java

我看到的唯一方法是使用纯 HTML 标签!

于 2013-06-07T16:46:13.667 回答