wei zhy

Greenhorn
+ Follow
since Mar 26, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by wei zhy

hi,
In my applet I build a URLConnection, it connect a jsp file. In my jsp file I refer to a javaBean. I send two objects of request and response in jsp to javaBean. In javabean return output stream to URLConnect. At that time a error happened.WHY???
Thanks.
My main code:
APPLET TestApplet)
URL url = new URL("http://210.0.8.120/jsp/test.jsp";
URLConnection con;
con = url .openConnection();
con = servlet.openConnection();
con.setDoInput( true );
con.setDoOutput( true );
con.setUseCaches( false );
con.setRequestProperty( "Content-Type","text/plain" );
con.setAllowUserInteraction(false);
ObjectOutputStream out;
out = new ObjectOutputStream(con.getOutputStream());
Serializable[] data ={"test"};
out.writeObject( data );
out.flush();
out.close();
//until here are all rigth
ObjectInputStream in = new ObjectInputStream( con.getInputStream() );//happened error
......

JSP:
TestBean testBean = new TestBean ();
testBean .execute(request, response);

JAVABEAN:
public void execute( HttpServletRequest request,
HttpServletResponse response )
{
ObjectInputStream in =
new ObjectInputStream(request.getInputStream());
String direct = (String) in.readObject();
System.out.prinltn("direct");
ObjectOutputStream out = new ObjectOutputStream( response.getOutputStream() );
SerializableSerializable[] data ={"answer"};
out.writeObject( data );
out.flush();
out.close();
}


Error detail:
java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:729)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:251)
at TestApplet.postObjects(TestApplet.java:172)
22 years ago
I have known some methods:
1.set the object into a session.
2.use the thread.
Pls tell me other method?
Thank and regards.
22 years ago

Originally posted by Manjunath Subramanian:
Hello All,
I am using a jsp for printing a report in a table format having more than 100 columns.
I know the printing mechanism in java.awt.But how do i print from a jsp file.This is urgently required.Kindly help.
Thanks in advance,
Manjunath


You can watch the java.awt.printJob class.Maybe you will get some useful information?
22 years ago
JSP