Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

applet servlet communication

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
}


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic