How can I store a javascript variable in jsp session

That variable needs to be passed to a servlet or jsp through a request to the server and then the servlet or jsp can place that variable into the session.

Regards,

Nate

That variable needs to be passed to a servlet or jsp through a request to the server and then the servlet or jsp can place that variable into the session.

Regards,

Nate

how to pass the javascript variable in servlet or java code directly.

You can't.

The variable has to be passed as part of a request.

JavaScript is client side. JSP and Servlet are server side.

Now, you can change variables in your JavaScript with JSP or Servlets, but you can't change a variable in JSP or Servlets with JavaScript.

Regards,

Nate

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.