Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Html POST & GET

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 67620
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
ram ragu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 !
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic