Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

the resutl of an Exception

Posted on 2003-03-03
5
Medium Priority
?
183 Views
Last Modified: 2013-11-24
I am using Tomcat, and I created a form, and servlet to handle the data parsing. But, I want the output of the servlet in a pop-up window. ( a small popup with "ok done" or "not ok, this is wrong" blabla...)

in other words, how can I throw an exception in a popup-window ?
0
Comment
Question by:ap458889
  • 3
5 Comments
 
LVL 1

Accepted Solution

by:
umangjoshi earned 70 total points
ID: 8056745
try
{
}
catch(Exception e)
{
    pw.write("<script language=JavaScript>");
    pw.write(" popWin = window.open('ServletURL','aaa','scrollbars=yes,width=100,height=100,top=100,left=100,menubar=no');
    pw.write("</script>");
}

---------------
ServletURL: you have to create other servlet and pass necessarry information requires to display proper message.
0
 

Author Comment

by:ap458889
ID: 8056870
what is pw ? pw.write(...)
Thanks !
0
 

Author Comment

by:ap458889
ID: 8056887
what is pw ? pw.write(...)
Thanks !
0
 

Author Comment

by:ap458889
ID: 8057042
Sorry for the previous question...
I did it like this:

PrintWriter pw = response.getWriter();
pw.println("<script language=JavaScript>");
pw.println(" popWin = window.open('/user/error.jsp','aaa','scrollbars=yes,width=100,height=100,top=100,left=100,menubar=no')");
pw.println("</script>");

but: this will create a popup, BUT the form is submitted, so the actual window is black... the same window should be there.

Thx
0
 
LVL 2

Expert Comment

by:cocojohn
ID: 8057187
You can post the form into the popup window:

<script language="javascript">
  function doSubmit(){
    win2 = window.open("", win2, "height:200,width:200");
    document.myForm.target = "win2";
    document.myForm.submit();
  }
</script>

<form action="theServlet" name="myForm" onSubmit="doSubmit();">
  <!-- form elements -->
</form>

When myForm is submitted, the JavaScript opens a popup windows and changes the form's target.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
A solution for Fortify Path Manipulation.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month12 days, 12 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question