我需要获得像
这样的内容 <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>
所以我的问题: 如何在-Tag中获得id =“genealogy”(和type =“text / vnd.graphviz”)?
答案 0 :(得分: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");
}
我看到的唯一方法是使用纯HTML标记!