jsp中无法处理空指针异常。我想要如果下面的值为 null 则获取值 0,否则为值
<td width="30%">${ms:doubleTOInteger(requestScope.topActivityList[count.index].totalScore)} </td>
如果 count.index = 0 那么它工作正常 对于其他值,它返回 null(值为 0,1,2)
我尝试添加 if else 条件,但没有成功。
<%
if(request.getAttribute("topActivityList[count.index]") == null){
String token = new String("asd");
}
%>
<s:if test="token =='asd'">
<td width="30%" >${token}</td>
</s:if>
<s:else>
<td width="30%">${ms:doubleTOInteger(requestScope.topActivityList[count.index].totalScore)} </td>
</s:else>
之前更改了“doubleTOInteger”的自定义代码,但现在我已经更改了 java 代码