Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
If statement jstl if/else不能正常工作_If Statement_Jstl - Fatal编程技术网

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在上面发布的。。。查看文档!