hello,

i m trying to call java function from javascript. i want to pass js variable as a parameter to java function. pls anyone help me how can i do that..??

thank you..

Recommended Answers

All 2 Replies

Why do you want to pass java script variable value to a scriptlet(java code)?
The java code on a jsp will be running on server side .
java script is running on client side.
So if you want a value from java script to java scriptlet you can put the value in a HTML hidden variable on the page and submit the page
or if you are just requesting a URL , then pass it as a request parameter to the server side code.
Can you please post your code so that I can understand what you are trying to do?

Is it you want to pass js variable to servlet or JSp and based on that value you want to proceed further?
If it is then there are two options
1> You can pass variable and its value in url.
2> you can use Ajax call and pass parameter in that.

Hope this helps you...

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.