JSP exception errror

Discussion in 'JSP' started by jhaypeezim, Apr 4, 2009.

  1. jhaypeezim

    jhaypeezim New Member

    Joined:
    Apr 4, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    GOOD AM!!!

    could some1 plz help me with this error


    org.apache.jasper.JasperException: An exception occurred processing JSP page /Timein.jsp at line 105

    102: out.print("<TD>");
    103: rs = stmt.executeQuery("Select * from tbltime Where LName = (Select LastName from tblreg Where ENumber='" + eNumber + "')");
    104: rs.next();
    105: if((rs.getString(6)).equals("")){out.print("");}
    106: else{rs = stmt.executeQuery("Select Time_Format('"+(rs.getString(6))+"','%r')");
    107: rs.next();
    108: out.print(rs.getString(1));}
     
  2. fahadcv

    fahadcv New Member

    Joined:
    Apr 4, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi

    Replace line no 105 with below code

    if(rs.getString(6) == null || rs.getString(6).equals("")){out.print("");}

    Value may be null, so we need to check null also with empty string.

    Hope it will help.
     
  3. jhaypeezim

    jhaypeezim New Member

    Joined:
    Apr 4, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    thank you for your help
     
  4. LenoxFinlay

    LenoxFinlay Banned

    Joined:
    Apr 15, 2009
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    0
    You can catch exceptions in a JSP page like you would do in other Java classes. Simply put the code which can throw an exception/s between a try..catch block.
    <%
    try {
    // Code which can throw can exception
    } catch(Exception e) {
    // Exception handler code here
    }
    %>There is yet another useful way of catching exceptions in JSP pages. You can specify error page in the 'page' directive. Then if any exception is thrown, the control will be transferred to that error page where you can display a useful message to the user about what happened and also inform your sysadmin about this exception depending obviously on how important it may be.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice