我有一个 Jsp 页面,每次打开页面时都会加载警报框。我需要仅在满足特定条件时才显示此警报。这是我的 JSP。每次页面加载时都会加载一个空警报。
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<LINK REL="StyleSheet" HREF="css/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<form class ="menuOption" action ="MenuServlet" method ="GET">
<table border="0" class ="menuOption">
<tbody>
<tr>
<td>Enter Menu Option<input type="text" name="menuoption" value="" /><input type="submit" value="GO" name="gomenu" /></td>
</tr>
<tr>
<c: if test="${not empty nulloption}">
<script>alert("${nulloption}");</script>
</c:if>
<c:if test="${not empty invalidMenu}">
<script>alert("${invalidMenu}");</script>
</c:if>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>