我的原程序是:(绝对是正确的我择试了)我想弹出窗口,提示成功或不成,该怎么处理?//触发事件对"新用户的提交:"
          void jButton1_actionPerformed(ActionEvent e) {
                     oEreport = new ereport();//为取出id作准备
                     try{
                        oEreport.connectToDB();//取出记录数
                      }
                      catch(Exception e1)
                      {
                        System.out.println(e1);
                      }
                     strName = this.jTextFieldnewname.getText();
                     floMoney = Float.valueOf(jTextFieldmoney.getText());
                     strType = this.jComboBoxtype.getSelectedItem().toString();
                     if(strType =="用户名") {
                            String U="U";
                            strType = U;
                      }
                      if(  strType== "组名"){
                            String G="G";
                            strType = G;
                      }
                      ResultSet resDate = null;//为取出id作准备
                 try{                        String   strSql = "select max(\"id\") as maxnum from Savemoney";
                        resDate = oEreport.executeQuery(strSql);
                        if(resDate.next()){
                          iCount = resDate.getInt("maxnum");
                          iCount=iCount+1;
                        }
                      }
catch(Exception e1)
           {
    System.out.println(e1);
      }
                 try{
                     //插入记录
                     strSql = "Insert into Savemoney "+
                                     "Values ("+iCount+",'"+strName+"','"+strType+"',getdate(),"+floMoney +")";
                      System.out.println(strSql);
                     oEreport.executeUpdate(strSql);
                     }
                   catch(Exception e1){
                     System.out.println(e1);
                     }
                 }

解决方案 »

  1.   

    1、搞清brower和web交互的过程。
    2、搞清servlet/jsp在服务器上处理的过程然后你一定能清楚:用servlet写个javascript,由js在客户端蹦出个东西。
      

  2.   

    这个好办,你用javascript或vbscript不就轻松搞定了?
    你觉得这个很难吗?
    1。如果是用jsp程序对数据库进行操作:
       写入数据后直接用脚本语言提示就行了
    如:
    <%
    try
    {
      insert();
    %>
    <script language="vbscript">
    msgbox "录入成功",64,"提示信息"
    </script> 
    <%
    }
    catch(Exception e)
    {
      System.out.println(e);
    %>
    <script language="vbscript">
    msgbox "录入失败",64,"提示信息"
    </script> 
    <%
    }
    %>2。如果是在bean中的操作,也好办:
    你在bean中的录入数据模块中,录入后
    return 一个成功标记
    catch中
    return 一个失败标记
    在jsp中
    <%
    if (标记为成功标记) {
    %>
    弹出成功对话框
    <%
    }
    if (标记为失败标记) {
    %>
    弹出失败对话框
    <%
    }
    你看行吗?
      

  3.   

    注意:在失败提示以后可以return一下,可以使程序不再想下执行,也可以定位到别的页面!
    例如:
    if (标记为失败标记) {
    %>
    弹出失败对话框
    <%
    return;
    }
      

  4.   

    首先你要知道是否成功,然后使用下面的代码显示一个消息框:
    JOptionPane.showMessageDialog(bottomButton,//parentComponent
                                  message,//message for show
                                  title,  //title of diaglog
                                  JOptionPane.INFOMATION_MESSAGE);  //mesageType
      

  5.   

    谢谢,你们,
    按, zzmxw(风) ,你的成功了,
    我来加分