• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

refresh in post method

 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i know how to refresh in servlet using Get method , but when using Post method it gives error:

"HTTP Status 405 - HTTP method GET is not supported by this URL"

is there a way to refresh a servlet using Post method , i need this as my servlet uses Post method.

-TUSHAR
 
manoj r patil
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "to refresh a servlet"? Do you want to refresh the page rendered in the browser or something else? In first case, make sure proper HTTP method is set in the HTML form.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tushar panda wrote:
"HTTP Status 405 - HTTP method GET is not supported by this URL"


i guess you are triggering the servlet by applying the url in the address bar directly. so in this case only servlets's doGet method calls not doPost. if you want to use

doPost then do as "patil manoj" suggested
 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
patil manoj wrote:Do you want to refresh the page rendered in the browser or something else?.

yes
patil manoj wrote: In first case, make sure proper HTTP method is set in the HTML form .

when i am using Get method i get no error , but in Post method i got the error(i know that in post the values are not passed in url so i got error).

I just want to know a way using which i can refresh the servlet page in browser using Post method. I hope i am clear this time.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tushar panda wrote:I just want to know a way using which i can refresh the servlet page in browser using Post method.


refresh using post method is not a good idea . please search for PRG techniques for more details.

Coming to your question give a jsp url and onload you submit the form which will call the servlet's doPost
 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
seetharaman venkatasamy wrote:
Coming to your question give a jsp url and onload you submit the form which will call the servlet's doPost

the point is i cannot use a jsp url & then submit the form to servlet , because the servlet is already sent from another servlet by request dispatcher, by no means i can access it with a form , i can only retrieve value from that servlet & the value is a cookie value .

now you must be thinking why iam using refresh because unless i refresh i am not getting the values in servlet page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic