Thiago Vacare
Thiago Vacare

Reputation: 70

JSTL - Comparing Strings

I'm trying to compare two strings but I can't get the result I need

I tried these formats:

<c:choose>
    <c:when test="${company == multi }">
       <a href="dashResumo.jsp?tr=<%=tr%>&company=VVO&nm=<%=nmTorr%>"></a>
       <a href="dashResumo.jsp?tr=<%=tr%>&company=GPA&nm=%=nmTorr%></a>                                    
   </c:when>
 </c:choose>

<c:choose>
    <c:when test="${company == 'multi' }">
       <a href="dashResumo.jsp?tr=<%=tr%>&company=VVO&nm=<%=nmTorr%>"></a>
       <a href="dashResumo.jsp?tr=<%=tr%>&company=GPA&nm=%=nmTorr%>">GPA</a>                                    
   </c:when>
</c:choose>

<c:choose>
    <c:when test="${company.equals("multi") }">
       <a href="dashResumo.jsp?tr=<%=tr%>&company=VVO&nm=<%=nmTorr%></a>
       <a href="dashResumo.jsp?tr=<%=tr%>&company=GPA&nm=%=nmTorr%></a>                                    
   </c:when>
</c:choose>

but none of these formats worked for me.

Using JSTL-1.2 library

Upvotes: 3

Views: 4793

Answers (1)

David P&#233;rez Cabrera
David P&#233;rez Cabrera

Reputation: 5048

Try with this:

<c:choose>
    <c:when test="${company eq 'multi'}">
        <a href="dashResumo.jsp?tr=<%=tr%>&company=VVO&nm=<%=nmTorr%>">VVO</a>
        <a href="dashResumo.jsp?tr=<%=tr%>&company=GPA&nm=<%=nmTorr%>">GPA</a>                                    
    </c:when>
</c:choose>

Upvotes: 3

Related Questions