aspose file tools*
The moose likes Beginning Java and the fly likes Java from a web page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java from a web page" Watch "Java from a web page" New topic
Author

Java from a web page

anna markov
Greenhorn

Joined: May 05, 2009
Posts: 2
Hello,
I wonder if it is possible to make a main class to execute in the server by clicking a submit button in a web page.

greetings
anna
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41885
    
  63
Welcome to JavaRanch.

Do you mean something like a servlet (which is the standard way of executing Java code on a server)?


Ping & DNS - my free Android networking tools app
anna markov
Greenhorn

Joined: May 05, 2009
Posts: 2
Yes, kind of. I have a some java code in a main class that I need to run whenever a button is clicked.
I understand the button should launch a servlet, and then, should I put the code of the main class in another one the servlet can call?

thanks
anna
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41885
    
  63
You could make it a different class, or you could keep it in the servlet class. It depends a bit on what the class (or method) does, and how big it is.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java from a web page