DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    John Mcluskey Guest

    What this bean is not called ?


    Hi there ! It has been two weeks, I`ve been working on this issues but yet
    no accomplishment.!
    My page.jsp refers to newbean.java.
    I have succesfully compiled newbean.java and produced a class.
    The error I get is that , it doesn` seem to give me any results. My results
    are :-

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    SELECT LOT_ID, FLOW_ID, TST_TEMP, MODE_COD, RTST_COD, PART_CNT, GOOD_CNT,
    OPER_NAM, JOB_REV, PROC_ID, START_T, FACIL_ID, TSTR_TYP, NODE_NAM FROM LOT
    where START_T > TO_DATE('05/30/2002','MM/DD/YYYY') AND TST_TEMP <='' order
    by START_T

    Select Lot(s)|Flow|Temp|Test|Mode|Retest|Total|Good|Bad|Yield|UserID|Program|Mask|Start
    Time|Loc|Tester|System

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    PLEASE ASSIST ! I``m enclosing my page.jsp and newbean.java

  2. #2
    John Mcluskey Guest

    Re: What this bean is not called ?


    Page.jsp
    ------------------------------
    <%@ page contentType="text/html;charset=windows-1252"%>
    <!--import the bean file.... -->
    <%@ page import = "mybeans.newbean" %>
    <jsp:useBean class="mybeans.newbean" id="bean" scope="session" />
    <jsp:setProperty name="bean" property="*"/>
    <html>
    <head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
    </head>
    <body>
    <jsp:include page="/index.html" flush="true" />


    <TABLE BORDER=1 cellpadding=0 cellspacing=0>
    <%bean.connect();
    out.println("<TR>");
    out.println("<TD> Select Lot(s)</TD>");
    out.println("<TD>Flow </TD>");
    out.println("<TD>Temp </TD>");
    out.println("<TD>Test Mode </TD>");
    out.println("<TD>Retest</TD>");
    out.println("<TD>Total </TD>");
    out.println("<TD>Good</TD>");
    out.println("<TD>Bad</TD>");
    out.println("<TD>Yield </TD>");
    out.println("<TD>UserID</TD>");
    out.println("<TD>Program</TD>");
    out.println("<TD>Mask</TD>");
    out.println("<TD>Start Time </TD>");
    out.println("<TD>Loc </TD>");
    out.println("<TD>Tester</TD>");
    out.println("<TD>System </TD>");
    out.println("</TR>");
    %>
    <%bean.startquery(request.getParameter("date")); %>
    <%=bean.displayresult() %>
    <%bean.disconnect(); %>
    </TABLE>
    </body>
    </html>


  3. #3
    John Guest

    Re: What this bean is not called ?


    Newbean.java
    --------------------
    package mybeans;
    package mybeans;
    import java.sql.*;
    import java.lang.*;
    import java.text.*;
    import java.io.*;

    public class newbean
    {
    Statement stmt = null;
    Connection conn;
    ResultSet rset = null;
    String S_date = new String();
    String temp = new String();
    String lot_id = new String();
    String result = new String();
    String SQL_String = new String();
    String crap = new String();
    double yield;
    int bad_cnt;

    public void connect()
    {
    try
    {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn = DriverManager.getConnection("jdbcracle:thin:@klmomnidb:1521:OMNIDB","omni",
    "omni");
    }
    catch(SQLException sqle)
    { //System.err.println("Error connecting: " + sqle);
    //return(null);
    System.out.println("Caught SQL Exception: " + sqle.toString() + "<br>");
    }


    }

    static double roundDouble(double toBeRounded, int fractionDigits)
    {
    NumberFormat format = NumberFormat.getInstance();
    format.setMaximumFractionDigits(fractionDigits);
    String tempDouble = format.format(toBeRounded);
    return Double.parseDouble(tempDouble);
    }

    public void startquery(String S_date)
    {
    try
    {

    SQL_String = "SELECT LOT_ID, FLOW_ID, TST_TEMP, MODE_COD, RTST_COD, PART_CNT,
    GOOD_CNT, OPER_NAM, JOB_REV, PROC_ID, START_T, FACIL_ID, TSTR_TYP, NODE_NAM
    FROM LOT where START_T > TO_DATE('"+ S_date + "','MM/DD/YYYY') AND TST_TEMP
    <='" + temp+"' order by START_T";

    stmt = conn.createStatement();
    rset = stmt.executeQuery (SQL_String);
    }
    catch(SQLException sqle)
    {
    System.err.println("Error executin query: " + sqle);

    }
    }

    public String displaySQL()
    {
    return SQL_String;
    }

    public String displayresult()
    {
    try
    {
    if (!rset.next())
    {
    result ="No records found matching seach criteria.";
    }

    else while (rset.next())
    {
    bad_cnt = Integer.parseInt(rset.getString(6)) - Integer.parseInt(rset.getString(7));
    yield = (Double.parseDouble(rset.getString(7)) / Double.parseDouble(rset.getString(6)))
    *
    100;

    result= "<TR>";
    result = result + "<TD><a href=coolpage.jsp?LOT_ID=" + rset.getString(1)+
    ">" + rset.getS
    tring(1) + "</A></TD>";
    result = result + "<TD>" + rset.getString(2) + "</TD>";
    result = result + "<TD>" + rset.getString(3) + "</TD>";
    result = result + "<TD>" + rset.getString(4) + "</TD>";
    result = result + "<TD>" + rset.getString(5) + "</TD>";
    result = result + "<TD>" + rset.getString(6) + "</TD>";
    result = result + "<TD>" + rset.getString(7) + "</TD>";
    result = result + "<TD>" + bad_cnt + "</TD>";
    result = result + "<TD>" + roundDouble(yield,2) + "%</TD>";
    result = result + "<TD>" + rset.getString(8) + "</TD>";
    result = result + "<TD>" + rset.getString(9) + "</TD>";
    result = result + "<TD>" + rset.getString(10) + "</TD>";
    result = result + "<TD>" + rset.getString(11) + "</TD>";
    result = result + "<TD>" + rset.getString(12) + "</TD>";
    result = result + "<TD>" + rset.getString(13) + "</TD>";
    result = result + "<TD>" + rset.getString(14) + "</TD>";
    result = result + "</TR>";
    return(result);
    }
    }

    catch(SQLException sqle)
    {
    //System.err.println("Error executin query: " + sqle);
    //System.out.println("Query is : " + SQL_String + "\n\n");

    System.out.println("Caught SQL Exception: " + sqle.toString() + "<br>");

    }

    return(result);
    }

    }

    public void disconnect()
    {
    try
    {
    conn.close();
    }
    catch(SQLException sqlex)
    {
    System.err.println( "Unable to Disconnect" );

    }
    }

    }



  4. #4
    MarkN Guest

    Re: What this bean is not called ?


    John,
    I'm not sure what you are saying your results or errors are. Your JSP
    does seem to have an error <%=bean.displayresult() %> probably show include
    a ';'. If the results are what are shown between the carrot tops ('^') the
    where are they showing up.

    Hopefully your bean is for learning and not implementing.

    Mark

    "John Mcluskey" <khalsaji99@yahoo.com> wrote:
    >
    >Hi there ! It has been two weeks, I`ve been working on this issues but yet
    >no accomplishment.!
    >My page.jsp refers to newbean.java.
    >I have succesfully compiled newbean.java and produced a class.
    >The error I get is that , it doesn` seem to give me any results. My results
    >are :-
    >
    >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    >SELECT LOT_ID, FLOW_ID, TST_TEMP, MODE_COD, RTST_COD, PART_CNT, GOOD_CNT,
    >OPER_NAM, JOB_REV, PROC_ID, START_T, FACIL_ID, TSTR_TYP, NODE_NAM FROM LOT
    >where START_T > TO_DATE('05/30/2002','MM/DD/YYYY') AND TST_TEMP <='' order
    >by START_T
    >
    >Select Lot(s)|Flow|Temp|Test|Mode|Retest|Total|Good|Bad|Yield|UserID|Program|Mask|Start
    >Time|Loc|Tester|System
    >
    >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    >PLEASE ASSIST ! I``m enclosing my page.jsp and newbean.java



  5. #5
    Tony John Guest

    Re: What this bean is not called ?


    Store the result of the expression <%=bean.displayresult() %> in a String
    variable before you display it. For example:

    <% String result = bean.displayresult() %>
    <%= result %>

    This should work :-)


    "MarkN" <java.@127.0.0.1> wrote:
    >
    >John,
    > I'm not sure what you are saying your results or errors are. Your JSP
    >does seem to have an error <%=bean.displayresult() %> probably show include
    >a ';'. If the results are what are shown between the carrot tops ('^')

    the
    >where are they showing up.
    >
    >Hopefully your bean is for learning and not implementing.
    >
    >Mark
    >
    >"John Mcluskey" <khalsaji99@yahoo.com> wrote:
    >>
    >>Hi there ! It has been two weeks, I`ve been working on this issues but

    yet
    >>no accomplishment.!
    >>My page.jsp refers to newbean.java.
    >>I have succesfully compiled newbean.java and produced a class.
    >>The error I get is that , it doesn` seem to give me any results. My results
    >>are :-
    >>
    >>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    >>SELECT LOT_ID, FLOW_ID, TST_TEMP, MODE_COD, RTST_COD, PART_CNT, GOOD_CNT,
    >>OPER_NAM, JOB_REV, PROC_ID, START_T, FACIL_ID, TSTR_TYP, NODE_NAM FROM

    LOT
    >>where START_T > TO_DATE('05/30/2002','MM/DD/YYYY') AND TST_TEMP <='' order
    >>by START_T
    >>
    >>Select Lot(s)|Flow|Temp|Test|Mode|Retest|Total|Good|Bad|Yield|UserID|Program|Mask|Start
    >>Time|Loc|Tester|System
    >>
    >>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    >>PLEASE ASSIST ! I``m enclosing my page.jsp and newbean.java

    >



  6. #6
    Tony John Guest

    Re: What this bean is not called ?


    Oops... Forgot to include the ";".

    <% String result = bean.displayresult() %>

    after the semi-colon should look like:
    <% String result = bean.displayresult(); %>

    I know its late but hope this helps.

    "Tony John" <tonyjohn@hotmail.com> wrote:
    >
    >Store the result of the expression <%=bean.displayresult() %> in a String
    >variable before you display it. For example:
    >
    ><% String result = bean.displayresult() %>
    ><%= result %>
    >
    >This should work :-)
    >
    >
    >"MarkN" <java.@127.0.0.1> wrote:
    >>
    >>John,
    >> I'm not sure what you are saying your results or errors are. Your JSP
    >>does seem to have an error <%=bean.displayresult() %> probably show include
    >>a ';'. If the results are what are shown between the carrot tops ('^')

    >the
    >>where are they showing up.
    >>
    >>Hopefully your bean is for learning and not implementing.
    >>
    >>Mark
    >>
    >>"John Mcluskey" <khalsaji99@yahoo.com> wrote:
    >>>
    >>>Hi there ! It has been two weeks, I`ve been working on this issues but

    >yet
    >>>no accomplishment.!
    >>>My page.jsp refers to newbean.java.
    >>>I have succesfully compiled newbean.java and produced a class.
    >>>The error I get is that , it doesn` seem to give me any results. My results
    >>>are :-
    >>>
    >>>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    >>>SELECT LOT_ID, FLOW_ID, TST_TEMP, MODE_COD, RTST_COD, PART_CNT, GOOD_CNT,
    >>>OPER_NAM, JOB_REV, PROC_ID, START_T, FACIL_ID, TSTR_TYP, NODE_NAM FROM

    >LOT
    >>>where START_T > TO_DATE('05/30/2002','MM/DD/YYYY') AND TST_TEMP <='' order
    >>>by START_T
    >>>
    >>>Select Lot(s)|Flow|Temp|Test|Mode|Retest|Total|Good|Bad|Yield|UserID|Program|Mask|Start
    >>>Time|Loc|Tester|System
    >>>
    >>>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    >>>PLEASE ASSIST ! I``m enclosing my page.jsp and newbean.java

    >>

    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links