i want to pass the var num to a servlet. I am aware of how to retrieve a variable using
String num = request.getParameter("var"); but i do not think this is appropriate for what i am trying to do. Does anyone have any idea of what i am doin wrong?
To get the value of the JavaScript variable, a request needs to be submitted to the servlet, passing the value as a request parameter. That can happen on the URL, or as part of a form submission.
In the servlet, you'd use the getParameter() method to retrieve it.
I'm not sure what you are trying to achieve here, but if you want to send some values to the server from your JSP without reloading the page (i.e. submit), then you can use AJAX to make a request to the servlet...
basically the reason i want to do this is that i have a dynamic form that extends to add multiple inputs. I want to assign a unique id to each impairment as the form extends. Then the servlet requests the impairment name with the unique id so i can iterate over them and add them into the datase