Forums Register Login

Calling Servlet from Java application

+Pie Number of slices to send: Send
Hi All,
Thanks.
I am unable to call my servlet from my stand alone java application
Following is the code which I used,



Please help me ....
It is great if you could give example links which are wokring.

Regards,
Sree
+Pie Number of slices to send: Send
What happens when you try? Any error messages?
+Pie Number of slices to send: Send
How is this code working or not working? What do you expect to happen if you instruct the connection to perform neither input nor output?
+Pie Number of slices to send: Send
Thanks for your reply.
Even I tried with con.setDoOutput(true); but nothing is happening.
Just I have written one System.out.println() in my Servlet when I run the above program the statement which is written in SOP is not printing.
Could you please give me any example.
+Pie Number of slices to send: Send
Is your server which is on IP 12.234.26.2, running on port 80 or some other port??
+Pie Number of slices to send: Send
Yes it is running on 9080 port.
In URL I tried with :9080 also, but not helpful.
+Pie Number of slices to send: Send
You aren't reading the output at all. Get the InputStream and read it.
+Pie Number of slices to send: Send
Why do you setDoInput and setDoOutput to false???

Did you actually read the URLConnection and HttpURLConnection JavaDocs?

If you are going to read an input stream from the response, doInput needs to be true.

Bill
+Pie Number of slices to send: Send
There will be plenty of time to discuss your objections when and if you return. The cargo is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1261 times.
Similar Threads
Query about event for refresh button??
Any way to overcome Circular Redirect using HttpClient 4.1.1
Connecting to the webserver from simple java program with main method
HttpURLConnection question on POST Method
Servlet Communication using java.net
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:36:00.