javajavascriptjspscriptlet

How do I pass JavaScript values to Scriptlet in JSP?


Can anyone tell me how to pass JavaScript values to Scriptlet in JSP?


Solution

  • Your javascript values are client-side, your scriptlet is running server-side. So if you want to use your javascript variables in a scriptlet, you will need to submit them.

    To achieve this, either store them in input fields and submit a form, or perform an ajax request. I suggest you look into JQuery for this.