• Post Reply Bookmark Topic Watch Topic
  • New Topic

unexpected exception:please help  RSS feed

 
John Mclain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone,

i want to make a one way communication between applet and servlet.morever trying to send an array of string along the path stated and for that accomplishment i got stuck around the following code at client and server side.
when i run the code, having the following exception at server side




at client side(applet). dont confuse with jspURL, that is for servlet.



and this is at server side(servlet)



one more point for your sake of nailing my problem,

exception is being thrown at this line, and there is no any error at sun java console
please let me out of this headache

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am going to take a highly scientific wild guess that your servlet side code tries to look at parameters before you start the attempt to read the object stream - this will position the input stream at EOF and cause an error.

Any attempt to look at request parameters causes the whole stream to be read.

Bill
 
John Mclain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok i understand a bit, but its not enough to fix it.

so please tell, where should i make change in code at server side?

waiting for a quick reply.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by assantosh tripathi:
ok i understand a bit, but its not enough to fix it.

If that's the problem (and only you can tell us that) then, yes it is.


so please tell, where should i make change in code at server side?

Until you've confirmed that this is the problem nobody is going to be able to give you specific code changes to fix this.


waiting for a quick reply.

Please read this.
 
John Mclain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Mr William wrote:

I am going to take a highly scientific wild guess that your servlet side code tries to look at parameters before you start the attempt to read the object stream - this will position the input stream at EOF and cause an error.



please let me clear a bit more, what exactly you want to say.


Any attempt to look at request parameters causes the whole stream to be read


but i think i am not attempting to read any request parameter before call to ObjectInputStream.

then why this exception is still thrown?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the process by which the request ends up at the code you have listed? I am assuming you have a custom doGet method.

Apparently, after your applet sends the object, you execute

to immediately hit the servlet with another request!

What is supposed to happen there? What actually happens?

Bill
 
John Mclain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Mr William
to immediately hit the servlet with another request!





William wrote:
What is supposed to happen there? What actually happens?


actually i proposed to chek, wheather am getting the sent object at servlet side by runnig this by appletContext method.
ok,now i have removed this line indeed i am not getting any exception right now, but before this i was getting the exception(stated erliar).

now what i am intended to do is,
i have made an registrationform by using applets in jsp page. when user clicks the next button, he must get a feedback for data entered by him. this feedback should be displayed in another jsp page in same directory.

for this accomplishment planned to send all the data(entered in registration.jsp) to a servlet(in diffrent directory)and from servlet, after getting a requestDispatcher for feedback.jsp all the data should be available at feedback.jsp.

in next button's clicked event(on registration.jsp) i have written all the applet -servlet communication code along with


after sending the obect over output stream to servlet so that i would be able to open the feedback.jsp for feedback.

am i doing right?
 
John Mclain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but when i tried go along the way stated in my above post i am getting the null value at feedback.jsp

servlet side code


and at jsp side i am retrieving the data by this code



to check wheather i am doing right i have sent an array of string from applet to servlet of size three. but later i would send the actual data.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


At what point have you made sure that reg_data[0] is not null?

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!