File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Best way to open new browser window - HTTP request in java or webpage Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Best way to open new browser window - HTTP request in java or webpage" Watch "Best way to open new browser window - HTTP request in java or webpage" New topic
Author

Best way to open new browser window - HTTP request in java or webpage

Karina Guenther
Ranch Hand

Joined: Sep 16, 2005
Posts: 38
I have a web page that based upon the users actions, submits a request to a servelet. The servelet uses a properties file and what the user selected to build a url. I need to now open a new browser tab / window using that url. I could perform these actions on the web page, but I'm not sure which is best or exactly how to do it in java.

I've learned about using URLConnection, but I'm not sure what to return so that the new page is opened. The Url is to a page from a different app running on a different server.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56168
    
  13

You can't force a new window to open from the server. You need to do it on the client when the request is made.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Karina Guenther
Ranch Hand

Joined: Sep 16, 2005
Posts: 38
Thanks - that answers that question, so now I need to figure out how to feed my velocity values into javascript so that I can build the url and open my new window. I know js, but am new to velocity
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16482
    
    2

Yes, that's right. Just a hint: first design the Javascript you want to see, then figure out how to produce that Javascript. I know that might sound obvious but it's amazing (based on the posts I see here) how many people don't do it that way.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best way to open new browser window - HTTP request in java or webpage
 
Similar Threads
Looking for ideas/discussion on "Best Approach"
Can I use RequestDispatcher to open a new browser window
Thread-safe on HttpSession Object
dynamically link back into existing browser window?
open URL in specific frame.