You cannot. JSP is processing on the server; then the client takes over and JavaScript can process. You cannot pass values from JavaScript to JSP except in a new request.
Imagine you were traveling to Moscow, and you ask your mother to remind you when you get there to find a way to get in touch with her. It's too late, she can't make contact, you have to remember it by yourself.