• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

GET request call

 
Ranch Hand
Posts: 220
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ankit

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

 
Your mother is a hamster and your father smells of tiny ads!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic