aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Html POST & GET Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Html POST & GET " Watch "Html POST & GET " New topic
Author

Html POST & GET

ram ragu
Ranch Hand

Joined: Mar 12, 2002
Posts: 57
Hello!
We can do a GET or POST from a FORM but I want to open a new window and inside that I want to run my servlet ... and it
should be a POST
in the form we give like this
method="post" ACTION="http://localhost:8080/examples/servlet/GenerateReport"
but I have to do the following
myview=window.open("http://localhost:8080/examples/servlet/GenerateReport");
view.focus();
how to make the request as a POST when we open a new window?
anyidea how to do this
your help is highly appreciated!
Ram
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61187
    
  66

If you just want to open a new instance of the browser and not control what window decorations it has (via the 3rd parameter of window.open()) you may be able to achieve what you need by not using window.open() at all and by placing the following attribute on your <form> tag:

If that doesn't give you the amount of control that you need, please respond and maybe we can come up with something a bit more complex, but that could achieve your goal.
hth,
bear
[ May 03, 2002: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ram ragu
Ranch Hand

Joined: Mar 12, 2002
Posts: 57
Sorry! I can not use the TARGET
Reason is I want to control the new popup window and the toolbar .. at the same time I will not be submitting the form ... instead I will use the OnClick function of the button which is available in the FORM
submitRequest function will open a window and pass the url
Kindly let me know !
Charlie Sturman
Ranch Hand

Joined: Apr 04, 2002
Posts: 112
1.create the window:
submitWindow = window.open(... blank )
2.create the form in the new window using document.write:
submitWindow.document.write("html with the form tag ,atributes like method=post,action=servlethtml and form field
tags and the values you want to send.
submitWindow.document.close()
3.create a submit event:
submitWindow.document.form.submit()
btw:
If you were using get you could just append the fields to the uri.I assume you knew that
Here is an example similiar to what I am suggesting taken from an app I wrote:

[ May 04, 2002: Message edited by: Charlie Sturman ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Html POST & GET