<script type="text/javascript">
function getHeight(){
var alto = document.getElementById('table').offsetHeight;
document.getElementById('elemHeight').value = alto;
return alto;
}
</script>
<input type="hidden" value="-1" id="elemHeight" name="elem">
JSP
To collect the data in the JSP you just have to call the function getParameter()
with the name of the element of your form, getParameter('elem')
The best option is to save the value in a hidden input and retrieve it in the JSP when you submit the form. To check that the value is passed correctly you initialize the "hidden" to -1 to check in the jsp that the value of the input is different from -1. If you do not have a form, you can create it even if only for that element.