httpurlconnection problem

In my applcation if i use urlConn.setDoOutput(true), it gives me ...

java.lang.IllegalStateException: Already connected

at java.net.URLConnection.setDoOutput(URLConnection.java:739)

And if i dont use this function, this code gives ...

java.net.ProtocolException: cannot write to a URLConnection if doOutput=false -

call setDoOutput(true).

how to get rid of this error pls help.thanks in advance.

[438 byte] By [b.m.krajua] at [2007-11-27 2:56:08]
# 1
Call setDoOutput() before you get the input or output streams.
ejpa at 2007-7-12 3:33:31 > top of Java-index,Core,Core APIs...