Webrick Query-String

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

ยทยทยท

--
Posted via http://www.ruby-forum.com/.

Christian Kerth wrote:

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
  
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

<form action="/myServlet" method="POST">
  <input type="hidden" name="view" value="test" />
  ...
  <input type="submit"/>
</form>