user2925090
user2925090

Reputation: 9

How to compare 0 and 1 using strut tags

I am getting value 0 and one from database, and i want to compare that value in my jsp page, I tried below code, but its not comparing correctly.

<c:choose>
            <c:when test="%{#groupProfileView.userinfo. profilePrivacy}== 1">
          creator name: ${groupProfileView.userinfo.firstName}
          </c:when>
          <c:otherwise>anonmous</c:otherwise>
          </c:choose>

Upvotes: 0

Views: 94

Answers (2)

Paul Vargas
Paul Vargas

Reputation: 42020

If profilePrivacy is a number, try the next:

<c:when test="${groupProfileView.userinfo.profilePrivacy == 1}">

If profilePrivacy is a string, try the next:

<c:when test="${groupProfileView.userinfo.profilePrivacy == '1'}">

Upvotes: 1

Jigar Joshi
Jigar Joshi

Reputation: 240900

change it to

<c:when test='${groupProfileView.userinfo.profilePrivacy eq "1"'>

Related

Upvotes: 0

Related Questions