Basically, you want to hit the server and update the result at timed intervals. This is called "polling". Standard JSF has no builtin facilities for this, so you still need to write a bit of JS code yourself (or, theoretically, grab a JSF component which transparently renders the desired JS code for you). In JavaScript, you can use setInterval()
to execute a function at intervals.
So, once you give the timestamp component a fixed ID,
<h:outputText id="presentDateTime" value="#{bean.presentDateTime}" />
and you supply the below hidden form whose command button ajax-updates it,
<h:form id="hiddenForm" style="display:none">
<h:commandButton id="updatePresentDateTime">
<f:ajax render=":presentDateTime" />
</h:commandButton>
</h:form>
then you can get it to run with the below script executed during DOM/window/body ready.
<script>
setInterval(function() {
document.getElementById("hiddenForm:updatePresentDateTime").click();
}, 1000);
</script>
Don't use it for this very purpose (a client side clock) in production though. It's at most OK as an answer to an interview question (or as an example in some showcase page). In production, better grab "pure" JS, if necessary in combination with a poll which runs at a reasonable longer interval, e.g. 1 minute. Or if your environment supports it, use push via WS or SSE.