Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java fun  RSS feed

 
deshmukh amol
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mohamed Yousuff
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.


------------------
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!