I want to know how to call a java method from HTML (I Use HTML5) using java script. I tried using Applets but this didnt work. I have to take the value of a drop down box in the html file and take it to a java method to process it.
Asked
Active
Viewed 3,986 times
3 Answers
2
What you are looking for is AJAX. It's extremely easy to do with a library such as jQuery
$.get('your/servlet').done(function(data) {
// data is the data returned by the request
});

ThiefMaster
- 310,957
- 84
- 592
- 636
-
This is only the client part, which is not enough to answer the question. – ceving May 30 '12 at 14:32
-
The server-side code just needs to expose the function via an URL. Without knowing anything about his server-side architecture that's part impossible to answer. – ThiefMaster May 30 '12 at 14:34
0
You will want to do this with a request to a servlet. Like ThiefMaster said, Ajax is a good way to go
Here's a quick article to get you started: http://javapapers.com/ajax/getting-started-with-ajax-using-java/

Ben McCormick
- 25,260
- 12
- 52
- 71