• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java fun

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.



------------------
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic