Hi,
Here is the code snippet in which I have problem. When this part throws exception, request is sent to ErrorPage.jsp. Now the problem is, after forwarding the request to errorPage, the program should halt at this place and this value should not go in database...It takes hoursSpent value as 0......how should I halt flow at this point
Here is the code snippet in which I have problem. When this part throws exception, request is sent to ErrorPage.jsp. Now the problem is, after forwarding the request to errorPage, the program should halt at this place and this value should not go in database...It takes hoursSpent value as 0......how should I halt flow at this point
Code:
double hoursSpent = 0;
try {
hoursSpent = Double.parseDouble(request.getParameter("hoursSpentInput"));
}catch(NumberFormatException nfe) {
System.out.println("not a number"+nfe);
request.setAttribute("Message","Enter a number in 'Hours Spent'");
request.getRequestDispatcher("ErrorPage.jsp").forward(request,response);
}
.......//some code here
Comment