Forums Register Login

java fun

+Pie Number of slices to send: Send
I have to send data like (username,address,company name) from java method to a servlet.The servlet actually is invoked by an HTML page.so this servlet uses getParameter(" ..").Now my problem is sending data to this servlet and populating those parameters and invoking it.(i cannot change the servlet code).somebody help me.
+Pie Number of slices to send: Send

Use java.net.URL object to connect to the servlet from your java program. For example you want to call a servlet at javaranch site, use like this
new URL("http://www.javaranch.com/servlet/handler?username=x&address=y&compname=z")

Get the java.net.HttpURLConnection from this object and manipulate it. This works fine for the get methods only. For post methods, check methods in HttpURLConnecion object before opening the connection to the server.

Actually this is a normal problem and the solutions have been posted in this forum lot of times.

Originally posted by deshmukh amol:
I have to send data like (username,address,company name) from java method to a servlet.The servlet actually is invoked by an HTML page.so this servlet uses getParameter(" ..").Now my problem is sending data to this servlet and populating those parameters and invoking it.(i cannot change the servlet code).somebody help me.



------------------
The human mind is a dangerous plaything. This tiny ad is pretty safe:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 769 times.
Similar Threads
bean to servlet
How to call java class from servlet
Reading a non servlet constants and data from a servlet
FORM DATA TO XML TRANSACTION DATA
Java Servlets
More...

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