• Post Reply Bookmark Topic Watch Topic
  • New Topic

Call servlet from Application

 
Ali Hassaan
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,
I have to make an application which can call servlet on some other workstation and print the servlet result to my application.
Printing result to my application is not neccessary but i have to call the servlet neccessarily.
I was using HttpURLConnection but it doesnot works for me.
 
Mohammed Bawazeer
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I once used URLConnection with in an applet which is somehow similar to your application.

URL url = null;
URLConnection con = null;
InputStream in = null;
int response = -1;
try{
url = new URL(getCodeBase(),
"/servlets/yourServlets?param="+value);
con = url.openConnection();
in = con.getInputStream();
response = in.read();
}catch(Exception e){}
in.close();
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!