aspose file tools*
The moose likes Servlets and the fly likes refresh in post method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "refresh in post method" Watch "refresh in post method" New topic
Author

refresh in post method

tushar panda
Ranch Hand

Joined: Feb 16, 2009
Posts: 133
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


Do Right , Fear No Man
manoj r patil
Ranch Hand

Joined: Jun 06, 2002
Posts: 181
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.


love your job and not your company;
...because you never know when your company will stop loving you!
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

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

Joined: Feb 16, 2009
Posts: 133
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

Joined: Jan 28, 2008
Posts: 5575

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

Joined: Feb 16, 2009
Posts: 133
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: refresh in post method
 
Similar Threads
auto servlet refresh
Form action - Refresh
Implementing a message broadcast server using servlets
Problem at Page Reloading
How to refresh a Servlet automatically ?