You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Hello Jogetor guys,

I wrote beanshell script in beanshell tool plug-in. my question is how can call it in my form.

import java.util.*;
    import java.sql.*;
    import java.io.*;

    Connection conn = null;
        PreparedStatement stmt = null;
        try
       

Unknown macro: { \            String userName = "root"; \            String password = ""; \            String url = "jdbc}

\                 else\                

Unknown macro: {\                     System.out.println("not exists");\                 }

\             " macrohasbody="false" wikihasprecedingnewline="false" wikihastrailingnewline="false" >{
                String sql = "SELECT Count\() FROM app_fd_application WHERE app_fd_application.c_companyName = '#form.application.companyName#'";
                stmt = conn.prepareStatement(sql);
                ResultSet rs = stmt.executeQuery(sql);
                rs.next();
                boolean exists;
                if( exists = rs.getInt("COUNT\(
)") > 0)
               

Unknown macro: {\                     System.out.println("exists");\                 }


                else
               


            }            
        }
        catch (Exception e)
       

Unknown macro: {\             System.err.println("Exception}


        finally
       

Unknown macro: { \            try{\                     conn.close(); \                 }

\             " macrohasbody="false" wikihasprecedingnewline="false" wikihastrailingnewline="false" >

{ \\                 if(conn \!= null) \\                
Unknown macro: {\                     conn.close(); \                 }
\\             }


            catch(SQLException e)
           

Unknown macro: {\             }


        } 

BR

  • No labels