• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet to Applet

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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");
 
reply
    Bookmark Topic Watch Topic
  • New Topic