aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes opening a new window from servlet 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 "opening a new window from servlet" Watch "opening a new window from servlet" New topic
Author

opening a new window from servlet

Joseph Siao
Ranch Hand

Joined: Feb 26, 2004
Posts: 32
I have a jsp page that calls on a servlet. The servlet does something, like connect to a database, then get some data. after that, the servlet calls another jsp page.

my code for calling the new jsp page :

RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher("next.jsp");
if(dispatcher!=null){
dispatcher.forward(req,resp);
}

question : i want the next.jsp page to open on a new window, how do i do this?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Servlet code can do absolutely no client browser manipulation. Why? Because its serverside. You need clientside code to do this, so your only route is JavaScript.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I'll move this to the HTML and Javascript forum.
Dave
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
basically you need to have the servlet write the javascript statement to open the new window...



One problem, people with pop up blockers are going to block this window from opening.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: opening a new window from servlet