Thread: help me out

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    india
    Posts
    5
    Rep Power
    0

    help me out


    hai friends

    i am pasting the simple jsp file... in this jsp file the data base connection is there and queries are also used..... and the resultset data is retrieved.....

    but i am not able to see the query....

    i find this is a good way to write jsp ....where no queries are seen

    please help me in how to do like this... how the data base connection is made and how is he retrieving...

    the file is below



    <%@ include file="jtfincl.jsp" %>

    <%@ page language="java" %>
    <%@ page import="oracle.apps.ibu.common.IBUContext" %>
    <%@ page import="oracle.apps.ibu.common.IbuException" %>
    <%@ page import="oracle.apps.ibu.common.Employee" %>
    <%@ page import="oracle.apps.ibu.common.EmployeeInfo" %>
    <%@ page import="oracle.jdbc.driver.*" %>
    <%@ page import="oracle.apps.jtf.aom.transaction.*" %>
    <%@ page import="oracle.apps.jtf.base.resources.*" %>
    <%@ page import="oracle.apps.jtf.base.interfaces.MessageManagerInter"%>
    <%@ page import="oracle.apps.ibu.registration.IbuRegistration" %>
    <%@ page import="oracle.apps.ibu.registration.CustomerVO" %>
    <%@ page import="oracle.apps.ibu.common.IDNamePair" %>
    <%@ page import="oracle.apps.ibu.common.*" %>
    <%@ page import="oracle.apps.ibu.registration.*" %>
    <%@ page import="java.math.BigDecimal" %>


    <jsp:useBean id = "_displayManager"
    class = "oracle.apps.ibu.common.DisplayManager"
    scope = "application" />

    <jsp:useBean id = "ibuPromptManager"
    class = "oracle.apps.ibu.common.PromptManager"
    scope = "application" />

    <%
    String appName= "IBU";
    boolean stateless=true; // used for jtfsrfp.jsp
    SiteProperty.load();
    String username = SiteProperty.getGuestUsername();
    String password = SiteProperty.getGuestPassword();
    %>


    <%@ include file="jtfsrfp.jsp" %>

    <%
    String forwardURL = null;
    String backURL = null;
    String emailAddress = null;
    long employeeID = -1;

    String submitType = (String) request.getParameter("submitType");

    IBUContext _context = new IBUContext(_fwSession);

    String errorKey = "";
    String errorMessage = "";
    String errorStack = "";

    boolean currentStatus = true;

    Object lockx = new Object ();
    OracleConnection conn = null;
    try
    {
    TransactionScope.begin(lockx);
    try
    {
    conn = (OracleConnection)
    TransactionScope.getConnection();
    }
    catch ( Exception e )
    {
    throw new FrameworkException("Error getting connection..");
    }
    if ( conn == null )
    {
    throw new FrameworkException("Error getting connection..");
    }

    String[] textMsgs = new String[3];
    MessageManagerInter msgMgr = Architecture.getMessageManagerInstance();
    textMsgs[0] = msgMgr.getMessage("IBU_RG_CONTRACT24");
    //textMsgs[0] = " is not a valid employee email address.";
    textMsgs[1] = msgMgr.getMessage("IBU_RG_CONTRACT25");
    //textMsgs[1] = " Cannot get the employee id.";
    textMsgs[2] = msgMgr.getMessage("IBU_RG_CONTRACT13");
    //textMsgs[2] = "submitType is null, please check program.";

    if ( (submitType != null) && "LOGIN".equals( submitType ) )
    {
    forwardURL="jtflogin.jsp";
    backURL="jtflogin.jsp";
    }
    else if ( (submitType != null) && "EMPLOYEE_CHECK".equals( submitType ) )
    {
    forwardURL="ibuemplcheck.jsp";
    backURL="ibuemplcheck.jsp";
    }
    else if ( (submitType != null) && "EMPLOYEE_NUMBER_SUBMIT".equals( submitType ) )
    {
    backURL="ibuemplcheck.jsp";
    emailAddress = (String) request.getParameter("emailAddress");
    pageContext.setAttribute("emailAddress", emailAddress , PageContext.REQUEST_SCOPE);
    employeeID = IbuRegistration.getEmployeeID(conn,emailAddress);
    if (employeeID == -1)
    {
    throw new IbuRegException(emailAddress + "&nbsp; "+textMsgs[0] + "&nbsp; " +textMsgs[1]);
    }
    //validate employee
    currentStatus = Employee.isValidate(conn,emailAddress);
    //currentStatus = IbuRegistration.isEmployeeValid(conn,emailAddress);
    if (!currentStatus)
    {
    throw new IbuRegException(emailAddress + "&nbsp; " + textMsgs[0]);
    }
    /*
    EmployeeInfo employee = Employee.findEmployee(conn,employeeID);
    pageContext.setAttribute("employee", employee , PageContext.REQUEST_SCOPE);
    pageContext.setAttribute("employeeIDStr", Long.toString(employeeID) , PageContext.REQUEST_SCOPE);
    */
    forwardURL="ibuemplinput.jsp";
    }
    else
    { // Cancel button was pressed
    throw new IbuRegException(textMsgs[2]);
    /* "ibuccsii.jsp"; */
    }
    }
    catch ( IbuException e )
    {
    TransactionScope.setRollbackOnly();
    errorMessage = e.getMessage();
    errorStack = IbuRegException.getStack(e);
    pageContext.setAttribute("errorMessage", errorMessage , PageContext.REQUEST_SCOPE);
    pageContext.setAttribute("errorStack", errorStack , PageContext.REQUEST_SCOPE);
    forwardURL = backURL;
    }
    catch (IbuRegException e)
    {
    TransactionScope.setRollbackOnly();
    errorMessage = e.getMessage();
    errorStack = e.getStack();
    pageContext.setAttribute("errorMessage", errorMessage , PageContext.REQUEST_SCOPE);
    pageContext.setAttribute("errorStack", errorStack , PageContext.REQUEST_SCOPE);
    forwardURL = backURL;
    }
    catch ( Exception e )
    {
    TransactionScope.setRollbackOnly();
    errorMessage = e.getMessage();
    errorStack = IbuRegException.getStack(e);
    pageContext.setAttribute("errorMessage", errorMessage , PageContext.REQUEST_SCOPE);
    pageContext.setAttribute("errorStack", errorStack , PageContext.REQUEST_SCOPE);
    forwardURL = backURL;
    //throw new FrameworkException( e , "IBU_UNEXPECTED_EXCEPTION");
    }
    finally
    {
    TransactionScope.releaseConnection( conn );
    TransactionScope.end ( lockx );
    }
    if (forwardURL == null)
    {
    forwardURL="jtflogin.jsp";
    }

    %>
    <jsp:forward page= "<%= forwardURL %>" />

    <%@ include file="jtferlp.jsp" %>






    please help me out...

    ramesh
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    Well, first off, it's not a simple jsp file, it's actually pretty complicated.

    Second, in the future, it's polite to post a with a subject that's more descriptive of your problem than "Help".

    Now, as to answering your questions.
    Here is the connection:
    try
    {
    conn = (OracleConnection)
    TransactionScope.getConnection();
    }
    catch ( Exception e )
    {
    throw new FrameworkException("Error getting connection..");
    }
    Here are the queries:
    employeeID = IbuRegistration.getEmployeeID(conn,emailAddress);
    and
    currentStatus = Employee.isValidate(conn,emailAddress);
    Now, as for the code for oracle.apps.ibu.registration.IbuRegistration and oracle.apps.ibu.common.Employee that actually perform the queries, you're going to have to ask the author of those classes, since they seem to be prorietary.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    india
    Posts
    5
    Rep Power
    0

    regarding db connection


    hai bricker42

    i got the connection code from ur snippet of code...

    for example sir please take the table as emp

    and user id as scott and tiger(the default ones)


    can u tell me how to use the various select statements and get the result set and insert,update statements,and delete statements also..

    i basically need to know how to use the connection object ...

    if there are examples like this anywhere please send me or where can i find on the net.

    ramesh.s
  6. #4
  7. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    19
    Rep Power
    0
    hey, maybe you can check out some of the questions that i had posted. there are some codes which shows the sql statement and database connections..

    let me know if u have any problems.
  8. #5
  9. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14

IMN logo majestic logo threadwatch logo seochat tools logo