• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IO Exception in applet/servlet communication

 
Anil Sequeira
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am trying to call a servlet from a applet.But I am getting a IO exception(java.io.IOException) in my applet code.My code is...
URL u=new URL("http://mock:8100/demo/servlet/ChatTrackServlet1");
URLConnection uc=u.openConnection();
uc.setDoOutput(true);
uc.setUseCaches(false);
uc.setDefaultUseCaches(false);
uc.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
uc.connect();

PrintStream out = new PrintStream(uc.getOutputStream());
out.println("Get info from Servlet");
out.close();

InputStream in = uc.getInputStream();
StringBuffer response = new StringBuffer();
int chr;
while ((chr=in.read())!=-1)
{
response.append((char) chr);
}
in.close();
responseField.setText(response.toString());
Thanks

------------------
Anil Sequeira
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic