javajavascripthtmlwebcontent

Accessing Java class from HTML web app


I have a dynamic web project. In src folder I have Java class with couple of methods. Let us suppose index.html file has two buttons.on click of the button how can I call the Java class. Is there any possibility of doing so?


Solution

  • Create servlet which will handle get/post requests, invoke your java code and return result.

    http://docs.oracle.com/cd/E19857-01/819-6518/abxbh/index.html http://www.oracle.com/technetwork/java/servlet-142430.html