LPS-43940 Move functions from the page.jsp to java class, no logic changes

cc @ealonso