• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GET request call

 
Tuna Töre
Ranch Hand
Posts: 220
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Ankit Garg
Sheriff
Posts: 9580
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
Tuna Töre
Ranch Hand
Posts: 220
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ankit

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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic