Forums Register Login

GET request call

+Pie Number of slices to send: Send
I try to make a get request by a html form, but if I write method="get" the parameter is not passed to the servlet. On the other hand if I write method = "post" I can pass the parameter ? What do you think will the reason ?
I am a little confused. I write parameter only in action part of form like below


<form action="/ApacheProject/servlets/test.exe?param1=read" method="get">
<input type ="submit" value="Cookie Read" />
</form> -----> not working

<form action="/ApacheProject/servlets/test.exe?param1=read" method="post">
<input type ="submit" value="Cookie Read" />
</form> -----> working


servlet code extract

+Pie Number of slices to send: Send
Anut why are you using a query string in your action. In get request the browser must be removing the query string which is the reason of your problem If you want to pass a value to the server, use a hidden field like this

<form action="/ApacheProject/servlets/test.exe" method="get">
<input type="hidden" name="param1" value="read" />
<input type ="submit" value="Cookie Read" />
</form>
+Pie Number of slices to send: Send
Thanks Ankit

I try to invoke with <a> html tag, It also works...

Those who dance are thought mad by those who hear not the music. This tiny ad plays the bagpipes:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 718 times.
Similar Threads
Reading parameter from JSP page
Cookies example in HFSJ
Losing data from submit using the enter key
Cookie access with EL expression
mutipart/form-data
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:31:47.