I want to invoke a servlet printing "hello world" from a simple java class. I tried using following code fron the java class, but nothing happened. URL url = new URL("http://hostname ortnumber/servlet path/servletname");
Could anyone tell me how to run a servlet from a simple java program.
The URL path you started is the right direction. The Sun Networking Tutorial has a section on "working with URLs" that will get you the rest of the way there. In short, your Java program will submit a GET or POST request to the web server that works on the server just like a request from a browser. Your Java program can read the response like a browser; the browser would normally display the response but you can do whatever you like with it. [ August 27, 2006: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi