How to send a request to a JSP from a stand along java program

V

Venkat

Hi All,

I have to send a request to JSP with some key value pairs which is
executing in a Web server. Please help me in solving this problem.

I tried with the following procedure but I am not successful.

{

URL url;
StringBuffer buffer;
String line;
int responseCode;
HttpURLConnection connection;
InputStream input;
BufferedReader dataInput;

try
{

url = new URL("http://202.62.87.235//kidosoftware//mpayment.jsp");
connection = (HttpURLConnection)url.openConnection();
connection.setDoOutput(true);
connection.connect();
OutputStream os = connection.getOutputStream();
PrintWriter out = new PrintWriter(os);

out.write("key1=asdf");
os.close();

responseCode = connection.getResponseCode();
System.out.println("response code is"+responseCode);

connection.disconnect();
 
O

Obuseme

Not sure bout the code, but it looks like you have an extra (typo)
slash in the url that you have hardcoded in. Also, maybe some details
other than an unsuccessful coding attempt would be helpful (ie, a
stacktrace/exception, how you know it doesn't work, etc.).
 
A

Andrea Desole

Venkat said:
Hi All,

I have to send a request to JSP with some key value pairs which is
executing in a Web server. Please help me in solving this problem.

what problem? The code works.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top