• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet to Applet  RSS feed

 
venkat thota
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to pass object from servlet to applet.For that i have written the below code but im getting error while creating object itself.So please help me.

This is the method i had written in my applet but while running
im getting error "java.lang.IIlegalStateException:cann't mix text and binary input " at line one.

public void sendMatterData(HttpServletResponse response, Vector matterVector){
ObjectOutputStream matterData;
try
{
1. matterData = new ObjectOutputStream(response.getOutputStream());
2. matterData.writeObject(matterVector);
3. matterData.flush();
4. matterData.close();
}
catch (IOException e)
{
System.out.println("Eroor :"+e);
}
}
please help me
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you need to set the content type of your response to binary, as opposed to text/html.
eg.
response.setContentType("application/octet-stream");
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!