this reply is what i get from SitePoint forum
to call a function of the java of the server-side from java scriopt. In this case you can use
1) XMLHTTP object to invoke the JSP/ACTION/SERVLET of the server trhough client side.
2) pass the value to that request.
3) get the response and dispaly it on the page.
any idea on that?
Have you considered using DWR for your AJAX calls. It's a very simple open source framework for implementing AJAX into your Java Web application. One of the benefits of using DWR is easy browser compatibility, the framework will generate most of the client side javascript for you, all you have to do is define your java classes in the dwr.xml, and define the dwr servlet in your web.xml.
I highly recommend using DWR for your AJAX calls.
http://getahead.ltd.uk/dwr/overview/dwr