# How to post form data to a servlet using ruby

**URL:** <https://rubytalk.org/t/how-to-post-form-data-to-a-servlet-using-ruby/43305>\
**Category:** ruby-talk\
**Created:** [26 December 2007 08:38 UTC](https://rubytalk.org/t/how-to-post-form-data-to-a-servlet-using-ruby/43305 "2007-12-26T08:38:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pradeepta\_Swain](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@Pradeepta\_Swain](https://rubytalk.org/u/Pradeepta_Swain)\
**Post date:** [26 December 2007 08:38 UTC](https://rubytalk.org/t/how-to-post-form-data-to-a-servlet-using-ruby/43305/1 "2007-12-26T08:38:36Z")

</div>

HI ,

&nbsp;&nbsp;&nbsp;&nbsp;How can i post form data to a servlet program using ruby .I am  
using the code

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;req.set\_form\_data({ 't1' =\> 'David', 't2' =\> 'hello' })  
where t1 and t2 are names of text field in html page

where url = URI.parse('[http://localhost:8080/Dev/CookieExample](http://localhost:8080/Dev/CookieExample)')

and CookieExample is the servlet

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Matt\_Todd](https://avatars.discourse-cdn.com/v4/letter/m/ed8c4c/32.png) [@Matt\_Todd](https://rubytalk.org/u/Matt_Todd)\
**Post date:** [27 December 2007 05:38 UTC](https://rubytalk.org/t/how-to-post-form-data-to-a-servlet-using-ruby/43305/2 "2007-12-27T05:38:48Z")

</div>

> &nbsp;&nbsp;&nbsp;&nbsp;How can i post form data to a servlet program using ruby .

There should be some useful documentation on ruby-doc.org/core for the  
Net::HTTP library for performing a POST request.
