client sending two messagese to servlet successivley using url object

My servlet on receiving first request from client:

//1. ObjectInputStream in=new ObjectInputStream(req.getInputStream()); String r=(String) in.readObject(); in.close(); ObjectOutputStream writer = new ObjectOutputStream(resp.getOutputStream()); writer.writeObject(pk); writer.close(); //ON receiving second request: //2. ObjectInputStream in1=new ObjectInputStream(req.getInputStream()); String s=(String) in1.readObject(); in1.close(); OutputStreamWriter writer1 = new OutputStreamWriter(resp.getOutputStream()); writer1.write(reverseStr); writer1.close();

But on both request only 1. is getting executed. why?

-------------Problems Reply------------

I asked this question without actually studying servlets. A servlet's method(doPost(),doGet() etc) are each called time a request is made to the servlet. Only the init() method is initialized or executed only once.
So each time a call is made to the above servlet, it starts executing from #line1.

Category:url Views:1 Time:2012-01-25

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.101 (s). 11 q(s)