当我执行以下代码时:
<script type="text/javascript">
function UploadMessage() {
<%! String message = null;
boolean AttemptToUploadFile = false;
%>
<%
message = (String)request.getAttribute("SuccessMessage");
if(message != null) {
%>
alert("File Successfully Uploaded !");
<% } %>
<% else if((Boolean)request.getAttribute("UploadAttempt")) { %>
alert("Unable to upload file");
<%}%>
}
我收到以下错误:
media/work documents/UnderTest/NetbeansCurrent/ProjectSnippets/build/generated/src/org/apache/jsp/portfolio_005fone_jsp.java:252: error: 'else' without 'if'
else if((Boolean)request.getAttribute("UploadAttempt")) {
1 error
错误说if
没有,else
但我已经在else
之后立即放置if
。那为什么会出错呢?