gpt4 book ai didi

java - 当/否则语句多个条件时出现 JSTL 错误

转载 作者:行者123 更新时间:2023-12-02 06:19:54 25 4
gpt4 key购买 nike

在我的 jsp 页面上遇到此错误

An unknown error has occured. 
weblogic.servlet.jsp.CompilationException: Failed to compile JSP /deployed/Student/resources/StudentUpdate.jsp
StudentUpdate.jsp:1163:3: The page failed validation from validator: "tag = 'out' / attribute = 'value': An error occurred while parsing custom action attribute "value" with value "${other_place_birth==null?'':other_place_birth}": Encountered "?", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||"]".
<c:when test="${birth_place_code != null && birth_place_code == '99'}">

这是我的代码

 <tr> 
<td width="17%" class=label > <b>Place of Birth</b>&nbsp; </td>
<td colspan="3" class=value> <div align="left"> <%=HtmlUtil.setListOptions("birthPlace","onchange ='javascript:SetEnabled()'",birth_place_option,birth_place_code,true,"")%>
if others, please specify remarks
<c:choose>
**<c:when test="${birth_place_code != null && birth_place_code == '99'}">**
<input type="text" size=41 maxlength=66 name="birthPlaceT" value="<c:out value="${other_place_birth==null?'':other_place_birth}"/>">
</c:when>
<c:otherwise>
<input type="text" size=41 maxlength=66 name="birthPlaceT" value=" " disabled>
</c:otherwise>
</c:choose>
</div></td>
</tr>

错误指向第一个when条件,不确定when语句中是否允许多个条件。感谢您的帮助

最佳答案

    <tr> 
<td width="17%" class=label > <b>Place of Birth</b>&nbsp; </td>
<td colspan="3" class=value> <div align="left"> <%=HtmlUtil.setListOptions("birthPlace","onchange ='javascript:SetEnabled()'",birth_place_option,birth_place_code,true,"")%>
if others, please specify remarks
<c:choose>
<c:when test="${birth_place_code != null && birth_place_code == '99'}">
<c:when test="${other_place_birth!=null}">
<input type="text" size=41 maxlength=66 name="birthPlaceT" value="<c:out value="${other_place_birth}"/>">
</c:when>
<c:otherwise>
<input type="text" size=41 maxlength=66 name="birthPlaceT" value="">
</c:otherwise>
</c:when>
<c:otherwise>
<input type="text" size=41 maxlength=66 name="birthPlaceT" value=" " disabled>
</c:otherwise>
</c:choose>
</div></td>

问题出在你的c:out上。不在c:时c:out 中不能有三元(或任何其他)条件。它仅用于显示值。

关于java - 当/否则语句多个条件时出现 JSTL 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21106920/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com