So basically you need to fire a request to the server.
1) A plain GET request using window.location.
2) A form submit using form.submit().
3) An asynchronous request using XmlHttpRequest object (Ajax).
That said, the term "JSP function" makes me think that you wrote raw Java code as scriptlet in a JSP file. This is considered a bad practice. You should write Java code in Java classes. Use a Servlet class as port to the Java code.