hi Deepak
I am sorry I can't send you any code for some reson as you understand!
I can tell you brief here !
following function should be there in SERVLET
I will call the following function from the doGet or doPost method of the servelt.
-------------------------------------------------------
public void senddata(HttpServletResponse response,
String data){
ObjectOutputStream outputToApplet = null;
try{
outputToApplet = new ObjectOutputStream(response.getOutputStream());
outputToApplet.writeObject(data);
outputToApplet.flush();
outputToApplet.close();
}catch(Exception e){
System.out.println("MyServlet: senddata() "+e.toString());
}
}
----------------------------------------------------------------
Let me explain!
String data in parameter of the above method is the data to be sent to applet.
We are sending the object so it could be anything like StringBuffer,ResultSet etc.
Thats servlet part over!
_________________________________________________________________
Applet part!:-
public Vector getdatafromServlet(){
ObjectInputStream inputFromServlet = null;
try{
URL servletURL = new URL(servletLocation);
URLConnection servletConnection = servletURL.openConnection();
servletConnection.setDoInput(true);
servletConnection.setDoOutput(true);
servletConnection.setUseCaches(false);
servletConnection.setDefaultUseCaches(false);
servletConnection.setRequestProperty("Content-Type","application/octet-stream");
inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
String resultdata = (String)inputFromServlet.readObject();
inputFromServlet.close();
}catch(ClassNotFoundException e){
}
catch(Exception e){
}
finally{
return resultdata;
}
}
----------------------------------------------------------------
In above function servletlocation is the url where servelt is located.
Just check out for returntype of inputFromServlet.readObject();
(I used Vector)
________________________________________________________________
I implemented the above communication I was through this So it has to work. Play around the code.
I found the above code Internet only so if you search a little bit more you will get the zip of the source code. Javawebserver 2.0 has this example!, Even you will find example in BEA weblogic server I Guess. I am sure about JWS2.0 Example.
BEST OF LUCK !
Further need assistance, I will help you
! But can't send any code to you.