Reputation: 79
in JSF, I were using: rich:popupPanel to display some information that calculated by Javascript. Normally I often use h:outputText to diplay value but I don't know how to diplay javascript value on HTML. Can I display it with h:outputText ? Thanks
Upvotes: 2
Views: 3254
Reputation: 1109532
Ignore JSF and just use the normal JavaScript/HTML DOM means. JSF is for them merely a HTML code generator. JS has no knowledge about the JSF source code, all it has access to is its generated HTML source code (exactly the one as you see by rightclick and View Source in the webbrowser).
Imagine that JSF has generated the following HTML, e.g. by <h:outputText id="foo">
or just hardcoding it as-is (you can just write plain HTML in a JSF page, do you know?):
<span id="foo"></span>
Then you can use JS as follows to fill its node value with a JS variable:
var foo = "some value";
document.getElementById("foo").innerHTML = foo;
This will ultimately appear dynamically as follows in the HTML DOM which get also visually reflected in UI:
<span id="foo">some value</span>
Upvotes: 2