Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URGENT-->New Window from Servlet

 
Mayank Chaturvedi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am calling a servlet from the Login Page . It does some check . If the check fails , I want a new window to open displaying the Error else if the check passes , the next page is loaded in the same window as the Login . In this case , no new window has to be opened .
Can someone tell me how we can open a new window from a servlet ?
 
anand chawla
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well its simple
use javascript this way
<%
if(request.getParameter("login")==null)
{
%>
<script>
window.open("error.html");
</script>
<% }
%>
 
Mayank Chaturvedi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for ur reply.
But , my problem is that I want to open the new window from the servlet code itself . So , I cannot use javascript there . So is there any code in Java from which I can open a new window ?
 
Mahajan Bhupendra
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i couldn't undrestand ur problem..
can't u use like this..
out.println("<script>window.open('location')</script>");
???
Bhupendra
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic