I got the following jsf-code:
<t:inputTextarea id="exportStatusMessage" cols="85" rows="10" readonly="true" value="#{ExportController.statusMessages}"/>
Is it possible to tell the inputTextarea to scroll to bottom after rendering the page? Maybe you know Eclipse-Console, I want to achieve this behaviour. Maybe there is a JavaScript-snippet or JSF-attribute which handles this issue - thanks in advance.
You can indeed just use JavaScript for this.
<h:form id="form">
<t:inputTextarea id="exportStatusMessage" ... />
</h:form>
<script>
var textarea = document.getElementById("form:exportStatusMessage");
textarea.scrollTop = textarea.scrollHeight;
</script>
Note that the script must be executed after the HTML <textarea>
representation is been added to the HTML DOM tree. So if you intend to put the script in its own .js
file, make sure that it's executed during page onload, or is been referenced in end of <body>
.