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?
if(passenger == null){
response.sendError(400, "The specified passenger does not exist.");
return; //or return null; depending on return type of method
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With