JavaServerFaces
(Weitergeleitet von JSF)
Zur Navigation springen
Zur Suche springen
Einbinden von JS-Dateien[Bearbeiten]
Dateibaum:
- webapp
- WEB-INF
- resources
- js
- common.js
- js
XML-Code:
<body< <h:outputScript library="js" name="myice.js" />
Dump eines DOM-Knotens[Bearbeiten]
function dumpNode(node, level){ var indent = ""; for (var ii = 1; ii <= level; ii++) indent = indent + " "; var rc = indent + "Tag: " + node.tagName + "\n"; if (node && node.hasChildNodes()){ var child = node.firstChild; while(child){ rc = rc + indent + dumpNode(child, level + 1); child = child.nextSibling; } } while(node){ node = node.nextSibling; if (node) rc = rc + dumpNode(node, level); } return rc; }
I18N[Bearbeiten]
in faces-config.xml:
<application> <resource-bundle> <base-name>i18n.messages</base-name> <var>i18nMsg</var> </resource-bundle> <locale-config> <default-locale>en</default-locale> <supported-locale>de</supported-locale> </locale-config> </application>
Sprachdatei resources/i18n/messages_en.properties
greetings=Greetings
Sprachdatei resources/i18n/messages_de.properties
greetings=Grüße
sample.xhtml:
<h:outputText value="#{i18nMsg.greetings}" />
Alternative I18n[Bearbeiten]
sample.jsf:
<f:loadBundle var="bundle" basename="messages.BookstoreMessages" /> <h:outputText value="#{bundle.greetings}" />