Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

invoking a servlet from client Java code

 
Pooja Agarwal
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai i am facing a problem in sending and receiving data to and from servlet .

i am not using any userinterfaces to do so.

My client code is
------------------


After executing my client code i need to get a response or some confirmation
data from servlet. How do i get that.
And if i want to check whether the data sent to servlet is properly reached by servlet or not.
I am not able to properly use servletoutput streams in order to do so.

Thanks in advance.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this was my problem I would take out:
dstream.close();

just flush the stream, don't close it.
Also you have this:

You can't open a new reader on the closed connection.
Bill
 
Sarah Gaikwad
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi pooja please write ur email id
 
Scott Duncan
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, when calling the servlet, won't it make the call to doGet by default? Call doPost from doGet if so.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic