• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Invokation through client Applet

 
Khurram Fakhar
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ppl,
Kindly tell me some way, by which i can send a servlet request to web server from java applet, i mean, by just clicking any button from client applet, i want to send servlet or jsp request to the web server which will send some JSP or servlet page which will open a new web browser and display the contents of the jsp .
Can we do this or not ??? if yes then tell me some hints or guide lines thanx
Kindly reply me fast as it is an urgent for me .
best regards
khurram fakhar
 
Asif Masood
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Khurram,
yes you can call a servlet from your applet by opening a connection to your servlet. The code below will help you to do this:
URL url = new URL("URL of your servlet");
URLConnection con = url.openConnection();
in = new DataInputStream(con.getInputStream());
String readData = in.readLine();
Now the readDate string will contain the output from your servlet. This will be the output which the servlet will write to its output stream.

Hope this will solve your problem. Ask if u need more help.
Asif Masood
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic