Não estou consequindo passar uma classe serializada para uma servlet, o que estou fazendo de errado alguem pode me ajudar
//Applet
public void sendContato(){
Contato data = null; // Temporary storage for the data.
URL servletURL = null; // The URL to the servlet.
URLConnection servletConnection = null; // The connection to the servlet.
ObjectOutputStream out =null;
data =new Contato();
data.setCodigo(99);
data.setNome(“Tst 99”);
data.setFone(“9999”);
try{
servletURL = new URL(“<a href="http://localhost:8080/appletservelt/servletdbcontato?send=true">http://localhost:8080/appletservelt/servletdbcontato?send=true</a>”);
servletConnection = servletURL.openConnection();
servletConnection.setDoOutput(true);
out = new ObjectOutputStream(servletConnection.getOutputStream());
out.writeObject(data);
}
catch( MalformedURLException ee ){
System.err.println( "MalformedURLException caught!" );
System.err.println( ee.getMessage() );
ee.printStackTrace( System.err );
}
catch( IOException eee )
{
System.err.println( "IOException caught!" );
System.err.println( eee.getMessage() );
eee.printStackTrace( System.err );
}
/*
finally{
try{
out.close();
}
catch( IOException eeeee ){
System.err.println( "IOException caught!" );
System.err.println( eeeee.getMessage() );
eeeee.printStackTrace( System.err );
}
}*/
}
//Servlet
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title>Servlet1</title></head>");
out.println("");
Contato data = null; // Temporary storage for the data.
ObjectInputStream dbStream = null; // The stream from the servlet.
try{
dbStream = new ObjectInputStream(request.getInputStream());
data = (Contato) dbStream.readObject();
}
catch( MalformedURLException ee )
{
System.err.println( “MalformedURLException caught!” );
System.err.println( ee.getMessage() );
ee.printStackTrace( System.err );
}
catch( IOException eee ){
System.err.println( “IOException caught!” );
System.err.println( eee.getMessage() );
eee.printStackTrace( System.err );
}
catch( ClassNotFoundException eeee ){
System.err.println( “ClassNotFoundException caught!” );
System.err.println( eeee.getMessage() );
eeee.printStackTrace( System.err );
}
finally{
try{
dbStream.close();
}
catch( IOException eeeee ){
System.err.println( “IOException caught!” );
System.err.println( eeeee.getMessage() );
eeeee.printStackTrace( System.err );
}
}
if(data != null){
out.println(data.getCodigo());
out.println(data.getNome());
out.println(data.getFone());
}
else
System.out.print("DataSetData is null, no object read.");
out.println("</body></html>");