Issue
I have the following bit of code in my java servlet:
if(passenger == null){
response.sendError(400, "The specified passenger does not exist.");
}
The page does redirect to the error page, however, the rest of the servlet code is still executed. How do I redirect and sort of 'break' out of the servlet?
Solution
if(passenger == null){
response.sendError(400, "The specified passenger does not exist.");
return; //or return null; depending on return type of method
}
Answered By - jmj
Answer Checked By - Cary Denson (JavaFixing Admin)