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.
2 Answers
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
});
2 Comments
ceving
This is only the client part, which is not enough to answer the question.
ThiefMaster
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.
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/