# Webrick Query-String

**URL:** <https://www.ruby-forum.com/t/webrick-query-string/121649>\
**Category:** Ruby\
**Created:** [November 29, 2007, 5:12pm UTC](https://www.ruby-forum.com/t/webrick-query-string/121649 "2007-11-29T17:12:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sealedsun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e68b1a/32.png) [@sealedsun](https://www.ruby-forum.com/u/sealedsun)\
**Post date:** [November 29, 2007, 5:12pm UTC](https://www.ruby-forum.com/t/webrick-query-string/121649/1 "2007-11-29T17:12:20Z")

</div>

Hey!

I have a Webrick Server set up.

When i do a GET Request i can access the query string values with:

req.query[‘key’]

When i do a POST request (action="/myServlet?view=test") out of a form i  
can acces the form fields with

req.query[‘field’]

but i don’t have access to the query string field ‘view’.

The method req.query\_string returns the correct string.

Is there a way to access the query string values in both request types  
in a similar way? What is best practice for accessing values (query and  
post data) in general?

thx

---

<div class="post-metadata">

**Author:** ![sealedsun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e68b1a/32.png) [@sealedsun](https://www.ruby-forum.com/u/sealedsun)\
**Post date:** [November 29, 2007, 5:28pm UTC](https://www.ruby-forum.com/t/webrick-query-string/121649/2 "2007-11-29T17:28:08Z")

</div>

Christian K. wrote:

> thx

It is my understanding that post requests do not have arguments in the  
url (the ?view=test part of your example), only gets.

If you are using a form you would need something like

 ...
