1

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
  • Applets? WTH. AJAX is the way to go. Commented May 30, 2012 at 14:29
  • Yes I do have an application server Commented May 30, 2012 at 14:35

2 Answers 2

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
});
Sign up to request clarification or add additional context in comments.

2 Comments

This is only the client part, which is not enough to answer the question.
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.
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/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.