You can get and set the current scroll position of an element in Javascript using element.scrollTop. Use a form handler onsubmitto save it as a hidden input element:
<h:form id="formId" onsubmit="saveScrollPos()">
<h:inputHidden id="scrollPos" />
...
with this function
function saveScrollPos() {
var scrollPos = document.getElementById('divId').scrollTop;
document.getElementById('formId:scrollPos').value = scrollPos;
}
Thus, it is available as a query parameter with a name formId:scrollPos. You can use Javascript to install it at boot time:
window.onload = function() {
var scrollPos = <h:outputText value="#{param['formId:scrollPos']}" />;
document.getElementById('divId').scrollTop = scrollPos;
}
divId - , , <div>, .