Go4Expert

Go4Expert (http://www.go4expert.com/)
-   JSP (http://www.go4expert.com/forums/jsp/)
-   -   JSP exception errror (http://www.go4expert.com/forums/jsp-exception-errror-t16794/)

jhaypeezim 4Apr2009 08:07

JSP exception errror
 
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));}

fahadcv 5Apr2009 06:57

Re: JSP exception errror
 
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.

jhaypeezim 5Apr2009 08:05

Re: JSP exception errror
 
thank you for your help

LenoxFinlay 16Apr2009 15:57

Re: JSP exception errror
 
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.


All times are GMT +5.5. The time now is 19:09.