开发者

Jstl <c:when > syntax

开发者 https://www.devze.com 2023-03-30 14:20 出处:网络
I am updating user status(true,false) form jsp page , here i am getting user status from controller class and displayed in option box , here i am using <c:when> jstl tag. see the below code

I am updating user status(true,false) form jsp page , here i am getting user status from controller class and displayed in option box , here i am using <c:when> jstl tag. see the below code

<c:choose>
    <c:when test="${roamingDenied == 'True')">
        <option value="True" selected>True</option>
        <option value="False">False</option>
    </c:when>
    <c:otherwise>
        <option value="True">True</option>
        <option value="False" selected>False</option>
    </c:other开发者_运维技巧wise>
</c:choose>

above code always displayed "False", plz any one give me suggestion for that..


The condition should be just

${roamingDenied}

or

${roamingDenied == true}

Also, there is a typo in your expression. It should be within {and }. Yours ends in a ).


It depends on the type of the value of attribute roamingDenied. Perhaps your roamingDenied is boolean not String like adarshr adviced.

0

精彩评论

暂无评论...
验证码 换一张
取 消