我将相同的 Java scriptlet 复制并粘贴到多个 .jsp 文件中。我想用更易于维护且可读性更好的解决方案替换它
<%
if (!MediaUtil.validateAuthorization()) {
out.println("Unauthorized");
} else {
String srcquery = request.getQueryString();
if (srcquery == null) {
srcquery = "";
}
User currentUser = UserService.findCurrentUser();
if (currentUser == null) {
out.println(User.MESSAGE_NO_USER);
} else {
%>
<html>
<head>
米琪卡哇伊
相关分类