Are you sure the strings are really identical?  For instance, just to be
sure you're using two different Strings with the same value, you can
experiment via the String copy constructor.  Doing this demonstrates that
JSTL's '==' operator does work correctly:

  <%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core"; %>

  <%
    String a = "foo";
    String b = new String(a);
  %>

  <c:if test="${a == b}">
    a indeed equals b
  </c:if>

Make sure that the two strings in your database don't have different
amounts of whitespace, are indeed of the same case (uppercase, lowecase,
etc.), and so on.  I often find it useful to print out values with a
marker (e.g., the ' character) on both sides to make sure I'm not missing
any whitespace.

-- 
Shawn Bayern
Author, "JSP Standard Tag Library"  http://www.jstlbook.com
(coming this summer from Manning Publications)

On Tue, 9 Apr 2002, marba wrote:

> I'm try to compare two string fields in a MySql table row
> here's my code that evaluate false even if the strings are identical:
> 
> <sql:query var="filiali" dataSource="${ds}">
>          SELECT * FROM FILIALI_EXT_LOG LEFT JOIN FILIALI_EXT USING (ID)
>         WHERE FILIALI_EXT_LOG.LASTMODI > <c:out
> value="${user.lastTimeStamp}"/>
>  </sql:query>
> 
> <c:forEach var="row" items="${filiali.rows}">
>         <c:set var="campi" value="51"/>
>             <c:forEach var="i" begin="0" end="${campi}">
> 
>                     <c:if test="${row.columns[i] == row.columns[i]}">
>                             evaluates true OK
>                     </c:if>
> 
>                     <c:if test="${row.columns[i] == row.columns[i+campi]}">
>                             evaluates false even if Strings are identical
>                     </c:if>
> 
> Thank You
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to