View Full Version : submit form/url parameters

02-23-2012, 09:16 AM
if I have submit form with element named foo
should I be able to do : url?foo=something
and read that on server ?

It seems it does not work, via url I get null ?

02-23-2012, 12:35 PM
What are you using/doing to try and read the url?

02-23-2012, 01:22 PM
java code:

foo = request.getParameter("foo");

<form action="..<%=request.getServletPath()%>" method="post">
<select name="foo">

if I hit submit button, request.getParameter... gets it right
if I try: url?foo=x, I get nothing.

I thought , both should work on same variable foo ?

02-23-2012, 03:43 PM
<form action="..<%=request.getServletPath()%>" method="post">

You have to change the method to GET (it is not POST).

<form action="..<%=request.getServletPath()%>" method="get">

The POST method is encrypted, you you will not see the parameters in the url. But the GET method send it in the URL. Doesn't matter if it arrives or not, you should see your parameters in the URL after pressing the submit button. ( ?var=something etc )