Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 java servlet 中有以下代码:
if(passenger == null){ response.sendError(400, "The specified passenger does not exist."); }
该页面确实重定向到错误页面,但是,仍然执行其余的 servlet 代码。如何重定向并从 servlet 中“中断”?
if(passenger == null){ response.sendError(400, "The specified passenger does not exist."); return; //or return null; depending on return type of method }