Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

opening a new window from servlet

 
Joseph Siao
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll move this to the HTML and Javascript forum.
Dave
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic