Hi,
No, it does not matter where you include JavaScript in a JSP page. But the best practice is to keep them in a .js file and include them in the template.jsp if you have any if not in the jsp page.
From the included file you can call the javascript function by passing the values.
Cheers
-Venu