在JSP页面的if条件之后没有执行代码



我在JSP上编写了以下代码:

System.out.println("------------------------medicine-------144444444444-----");

line我的下一个SOP没有来。那么到底出了什么问题呢?请帮助。

<%
    System.out.println("------------------------medicine-------144444444444-----");
    if (padetaillist6.get(a).getBph() != null && !padetaillist6.get(a).getBph().isEmpty()) {
%>
<div class = "form-group">
    <label style="width: 50px"  for="BP">BP</label>
    <input type="text" name="txtbph" id="txtbph" placeholder="High Bp"  class="form-control" style="color: black" value="<%=padetaillist6.get(a).getBph()%>">
</div>
/
<div class = "form-group">
    <label style="width: 50px"  for="BP"></label>
    <input type="text" name="txtlbp" id="txtlbp" placeholder="Low Bp"  class="form-control" style="color: black" value="<%=padetaillist6.get(a).getLbp()%>">
</div>
<%
    }
%>
<%
    System.out.println("------------------------medicine-------155555555-----");
    if (!padetaillist6.get(a).getRr().equals("")) {
%>
<div class = "form-group">
    <label style="width: 50px"  for="BP">RR</label>
    <input type="text" name="txtrr" id="txtrr" placeholder="RR" style="color: black"  class="form-control" value="<%=padetaillist6.get(a).getRr()%>">
</div>
<%
    }
%>

为if (padetaillist6.get(a).getBph() != null &padetaillist6.get(a). getbph (). isempty()),以便更好地了解if条件是否满足。还要检查日志以检查NPE。由于我们直接调用padetaillist6.get(a). getbph(),因此可能会更改为padetaillist6.get(a)获取null。

您能提供更多的代码细节吗?我认为这可能是一个逻辑错误。逻辑错误只能通过调试来解决。希望对大家有所帮助

您一定在这个JSP页面上遇到了一些异常。

因为你没有给出完整的代码,我假设你的异常在代码的某个地方被捕获,并且在给出页面输出时不存在。

可以在if块周围添加显式的try catch,并在那里添加检查是否被捕获。

最新更新