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.

Can I assign a Javascript variable to a JSP variable?

assign Javascript JSP
0
Posted

Can I assign a Javascript variable to a JSP variable?

0

It is not possible to directly assign client side Javascript variables to JSP variables because the Java assignment is created when the JSP document is compiled into a servlet, before the output is served to the client. Javascript variables are created on the client side when a Web browser interprets a script. One way to pass Javascript values to JSP variables is to include them as query parameters for a JSP document. The JSP document can then get the values via the request.getParameterValues(String) method. When you pass Javascript variables in query parameters it is important to pass the value through the escape(String) method, as below. … full answer hidden, click here for all answers Actions: Follow-up or correct this answer. Submit a new question.

What is your question?

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

Experts123