Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How Do You Assign Javascript Variable To Session Variable In Javascript Method With Coding Explain Detaily In Jsp?

0
Posted

How Do You Assign Javascript Variable To Session Variable In Javascript Method With Coding Explain Detaily In Jsp?

0

I’ll do my best to answer this, but the question isn’t 100% clear. The important thing to realize is that Javascript (I’ll use JS for short) is executed on the client (in the browser), and JSPs are executed on the server. The JSP generates the HTML page, including all of the JS code. So the answer to #2 is trivial, when you use JSP to create an HTML page and JS code, just create a JS variable as part of the page that you are creating. You might alternatively create some form elements and assign the variable that you are interested in there. For example, using the form element. Then javascript can access this hidden form element using myForm.hidden. Now, to pass a variable from JS back to the server where your JSP is executing, you need to post a form. JS allows you to submit a form proramatically (check out tutorials on the web such as at w3schools.com). In your JSP that is executed you will use the Request.get(“myVariable”) to get the values of the

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123