need help with http POST concept

hi i just started learning about HTTP..im trying to pass a value from a thin java client from command prompt through POST method directly to a destination (another java bean) without any HTML/jsp (no pages) .

i've created a caller.java which is used on command prompt :

java caller param1 param2

then, this caller will actually point to a struts path on my server, (which i think is a servlet) and do proper processing.

caller.java :

public static void main(String[] args) {...

.....

String url = str + "/do_something/prog0001_getAnswer?" +

"param1=" + args[0] +

"&param2=" + args[1];

URL server = new URL(url);

HttpURLConnection connection =

(HttpURLConnection) server.openConnection();

connection.setRequestMethod("POST");

connection.connect();

System.out.println("connecting to server..... " + connection.getResponseMessage());

......................

then on servlet :

httprequest's .getParameter("param1");

httprequest's .getParameter("param2");

to obtain the values.

even if set my URL's instance (server) 's RequestMethod to POST, i'm still able to obtain the parameter values in the servlet? I thought POST method requires different way to pass the values to a servlet? i've been searching..the most i could get are examples with HTML's FORM's name attribute

[1416 byte] By [adrivea] at [2007-10-2 18:33:17]
# 1
What method have you written in Servlet?service, doGet or doPost.If you have written service, then it does not matter what mthod you specified.
Pinkya at 2007-7-13 19:54:50 > top of Java-index,Java Essentials,Java Programming...