This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Karina Guenther
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65339
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Karina Guenther
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21581
33
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic