This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes invoking a servlet from client Java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "invoking a servlet from client Java code" Watch "invoking a servlet from client Java code" New topic

invoking a servlet from client Java code

Pooja Agarwal
Ranch Hand

Joined: May 19, 2004
Posts: 37
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

Joined: Mar 22, 2000
Posts: 13025
If this was my problem I would take out:

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

You can't open a new reader on the closed connection.
Sarah Gaikwad
Ranch Hand

Joined: Feb 26, 2004
Posts: 35
hi pooja please write ur email id
Scott Duncan
Ranch Hand

Joined: Nov 01, 2002
Posts: 364
Also, when calling the servlet, won't it make the call to doGet by default? Call doPost from doGet if so.

No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
I agree. Here's the link:
subject: invoking a servlet from client Java code
It's not a secret anymore!