aspose file tools*
The moose likes Servlets and the fly likes applet servlet communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "applet servlet communication" Watch "applet servlet communication" New topic
Author

applet servlet communication

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
hello friends,
i am dong applet servlet communication using ibm tool visual age.I am creating a test applet .I am using web sphere test environment.My applet is working fine in appletviewer
but when I run it through html tag I can't get the input stream.I am not getting any exception. But my server is not able to instantiating the servlet. I am giving the code below any body is having any idea what it's happening.Upto show5 it's working Then it becomes standstill.
my code is
try
{


url=new URL("http://localhost:8080/servlet/mypack.FloodQuestions");
uc=url.openConnection();
System.out.println("in show1");

//---------------------------------------------------------------------------------

//String send=URLEncoder.encode("send")+"="+URLEncoder.encode(SendData);
uc.setDoOutput(true);
System.out.println("in show2");
uc.setDoInput(true);
System.out.println("in show3");
uc.setUseCaches(false);
System.out.println("in show4");
//uc.setRequestProperty("Content-type","application/x-www-form-urlencoded");
System.out.println("in show5");
DataOutputStream dos=new DataOutputStream(uc.getOutputStream());
dos.writeBytes(SendData);
dos.flush();
dos.close();
//--------------------------read from server for next question--------------------------------


System.out.println("in show2"+uc.getInputStream());

ObjectInputStream obj=new ObjectInputStream(uc.getInputStream());
System.out.println("obj="+obj);
//get question vector
Questions=(Vector)obj.readObject();
System.out.println("question="+Questions);

//get answer vector
Answers=(Vector)obj.readObject();
System.out.println("Answers="+Answers);

//make question no as zero
QueNo=0;
System.out.println("end of data");

//------------------------------------------------------------------------------------
}catch(MalformedURLException e)
{
System.out.println("in malformed url");
e.printStackTrace();

} catch(IOException e)
{ System.out.println("in IOexception");
e.printStackTrace();
}

catch(ClassNotFoundException e)
{ System.out.println("in class not found");
e.printStackTrace();
}


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: applet servlet communication
 
Similar Threads
IOexception in Applet-servlet communication
applet-servlet communication
please help,very urgent..applet-servlet communication..
How applet can access database using browser ??????????
how to create a HTTP Client Program for servlet