Nos mandan de IBM este artículo de como correr scrits de JavaScrit en el servidor para manejo de control de sesiones (por ejemplificar).
Use a simple script runner that lets you execute JavaScript files within a Java EE application. The scripts will have access to the so-called “implicit objects” that are used in JSP pages, such as application, session, request, and response. Most of the samples consist of reusable code so that you can easily start using JavaScript on the server in your own applications.