If statement jstl if/else不能正常工作
我希望我的代码能做到这一点If statement jstl if/else不能正常工作,if-statement,jstl,If Statement,Jstl,我希望我的代码能做到这一点 <c:if test="${validated != 'Y' }"> <form:form id="newJob" method="post" action="updateValidated" commandName="jobModel"> <form:input path="regattaId" type="hidden" /> <form:input path="job_id" ty
<c:if test="${validated != 'Y' }">
<form:form id="newJob" method="post" action="updateValidated" commandName="jobModel">
<form:input path="regattaId" type="hidden" />
<form:input path="job_id" type="hidden" />
<table>
<tr>
<td><spring:message code="label.validated" />
<td><form:radiobutton path="validated" value="Y" />Yes<form:radiobutton
path="validated" value="N" />No</td>
</tr>
</table>
<input type="submit" class="button" value='<spring:message code="label.validateJob"/>' hidden="true" />
</form:form>
</c:if>
<c:else>
This job is validated
</c:else>
有人要吗?现在它不起作用了。
我认为我的语法是正确的,但我是非常新的等效代码是
<c:choose>
<c:when test="${validated != 'Y' }">
<form:form id="newJob" method="post" action="updateValidated"
commandName="jobModel">
<form:input path="regattaId" type="hidden" />
<form:input path="job_id" type="hidden" />
<table>
<tr>
<td><spring:message code="label.validated" />
<td><form:radiobutton path="validated" value="Y" />Yes<form:radiobutton
path="validated" value="N" />No</td>
</tr>
</table>
<input type="submit" class="button"
value='<spring:message code="label.validateJob"/>' hidden="true" />
</form:form>
</c:when>
<c:otherwise>
This job is validated
</c:otherwise>
</c:choose>
Jstl的c:if标记没有附带的c:else标记。试试c:选择 等效代码为
<c:choose>
<c:when test="${validated != 'Y' }">
<form:form id="newJob" method="post" action="updateValidated"
commandName="jobModel">
<form:input path="regattaId" type="hidden" />
<form:input path="job_id" type="hidden" />
<table>
<tr>
<td><spring:message code="label.validated" />
<td><form:radiobutton path="validated" value="Y" />Yes<form:radiobutton
path="validated" value="N" />No</td>
</tr>
</table>
<input type="submit" class="button"
value='<spring:message code="label.validateJob"/>' hidden="true" />
</form:form>
</c:when>
<c:otherwise>
This job is validated
</c:otherwise>
</c:choose>
Jstl的c:if标记没有附带的c:else标记。试试c:选择 不存在,也从未存在过。阅读你正在使用的东西,而不是尝试随机的东西
使用JSTL使if/else等效的正确方法是
<c:choose>
<c:when test="condition">...</c:when>
<c:otherwise>...</c:otherwise>
</c:choose>
不存在,也从来没有存在过。阅读你正在使用的东西,而不是尝试随机的东西
使用JSTL使if/else等效的正确方法是
<c:choose>
<c:when test="condition">...</c:when>
<c:otherwise>...</c:otherwise>
</c:choose>
没问题。正如JB在上面发布的。。。查看文档!没问题。正如JB在上面发布的。。。查看文档!