To make it on document ready, just place the script right before </body> that way the page itself is ready before the script is called. If the scripts are there, there is no need for document.ready.
You seem to have made the same mistake many other Java developers have made.
Javascript is not at all related to Java (other than both are C derivitives.) JavaScript is not a sub-set nor a scripting alternative to Java. JavaScript is parsed by the browser, JSP files are compiled.
I’ll flag your post and request a moderator to move it to a proper forum.