我正尝试根据使用JSP的数据可用性来显示div
。我的问题是,即使条件有效,并且执行了负责显示div
的相应块,我也无法查看在我的网页中呈现的上述部分。
<body>
<form>
<h3>Order Type</h3>
<div id="orderType" class="specialOrder">
<table>
<tr><td><label id="numberLabelId" for="numberId">Number</label>
<input type="text" name="number" id="numberId" onchange="processInput()"/>
<input type="hidden" name="groupSize" value="1" id="groupSizeId"/>
</td></tr>
</table>
</div>
<%
boolean dataReceived = false;
boolean isQualified = false;
String qualificationMessage = "";
String error = "";
if(request.getParameter("json") != null)
{
System.out.println("Response: " + request.getParameter("json"));
JSONObject jsonObject = JSONObject.fromObject(request.getParameter("json"));
MPQResponse mpqResponse = (MPQResponse) JSONObject.toBean(jsonObject, MPQResponse.class);
isQualified = mpqResponse.isQualified();
qualificationMessage = mpqResponse.isQualified() ? "Number is qulified for porting": "Number is not qualified for porting";
error = mpqResponse.getErrorMessage();
dataReceived = true;
System.out.println("Qualification status: " + qualificationMessage);
System.out.println("Error: " + error);
}
%>
<%
if(dataReceived && isQualified)
{
%>
<div><%=qualificationMessage%>/div>
<script type="text/javascript" >
refreshPage();
</script>
<%
}
else
{
%>
<div><%=qualificationMessage%></div>
<div><%=error%></div>
<%
}
%>
</form>
</body>
以上是我的代码的一部分;在上一节中,即使dataReceived
和isQualified
都是true
,该块中的div
部分也不会呈现(我可以看到代码使用了调试器)。我在干什么?我尝试使用JTL <c:if>
还是一样的结果。
答案 0 :(得分:0)
更改
<div><%=qualificationMessage%>/div>
到
<div><%=qualificationMessage%></div>
close div格式错误,缺少<
符号