html - Converting a Java program with main method into a servlet -
I am new to servlets. I have a query processor Java program and now, I want to use it in web application . I have an interface (HTML) that generates the query and I want to run the program on a button click in the interface. For this, I want to convert the Java program into a Java servlet. I am working in Net Beans.
The structure of my java program is as follows:
public class ABC {// code public ABC () // constructor {// code} public static zero main (string [] Args) {// code}} I want to convert it into a servlet The following is the default servlet structure in Net Beans.
Public class demo expands Httpservlet {/ * -------- ---- ---- * / Public Zero Processor Request (HTTPSRCLATOR request, HTTPSteam response ) Servlet upption, IOE expansion {/ * code * /} / * HTPSRLL methods - DOGet (), DOST () etc. * /} Option for main function in servlet? Which method is executed before Sewlett starts? Can I run Java program on a HTML page by clicking on a button so that I can terminate the use of the servlet?
use get or posted Depending on the servlet on the service, doGet , doPost and many HTTP methods you need to determine that you write the code
Comments
Post a Comment