JSP exception errror

jhaypeezim's Avatar, Join Date: Apr 2009
Newbie Member
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's Avatar, Join Date: Apr 2009
Newbie Member
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's Avatar, Join Date: Apr 2009
Newbie Member
thank you for your help
LenoxFinlay's Avatar
Banned
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.