title: JSTL: String Comparison issue using c:When tag
body: <p>I am facing problem when comparing 2 strings values using C:When tag<br>
  I am trying as follow</p>
  
  <pre><code>&lt;c:when test="${dbUserName eq uName}"&gt;
  </code></pre>
  
  <p>Where,<br>
  <code>dbUserName  = “sohail”</code>. It is fetching value from db column<br>
  <code>uName = “test”</code>. This is actually input value on login page<br>
  But comparison always giving result true…  </p>
  
  <p>Here is complete code  </p>
  
  <pre><code>&lt;%@ page contentType="text/html" %&gt;
  &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
  &lt;%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%&gt;
  &lt;HTML&gt;
  &lt;body&gt;
  &lt;c:set var='uName' value="${param.username}"/&gt;
  &lt;c:set var='uPassword' value="${param.password}"/&gt;
  &lt;sql:setDataSource var="db" driver="com.mysql.jdbc.Driver"
  url="jdbc:mysql://localhost:3306/test" user="root" password="sohail"/&gt;
  &lt;sql:query var="query1"  dataSource="${db}"
  sql="select * from login where loginID = '${uName}'"&gt;
  &lt;/sql:query&gt;
  &lt;c:forEach var="row" items="${query1.rows}"&gt;
  &lt;c:set var='dbUserName' value="${row.loginID}"/&gt;
  &lt;c:set var='dbUserPassword' value="${row.password}"/&gt;
  &lt;/c:forEach&gt;
  &lt;c:out value="${uName}"/&gt;
  &lt;c:out value="${row.loginID}"/&gt;
  &lt;c:out value="${row.password}"/&gt;
  &lt;c:choose&gt;
  &lt;c:when test="${dbUserName eq uName}"&gt;
  &lt;c:redirect url="profile1.jsp"/&gt;
  &lt;/c:when&gt;
  &lt;c:otherwise&gt;
  &lt;c:redirect url="checlLogin.jsp"/&gt;
  &lt;/c:otherwise&gt;
  &lt;/c:choose&gt;
  &lt;/body&gt; 
  &lt;/html&gt;  
  </code></pre>
  
  <p>Kindly suggest how can I fix comparison problem?   </p>
  
  <p>Hi Affe,<br>
  Thanks, you're right. The problem has been resolved<br>
  i just modified query as follow and it is working fine    </p>
  
  <pre><code>&lt;sql:query var="query1"  dataSource="${db}"
  sql="select * from login"&gt;
  &lt;/sql:query&gt;  
  </code></pre>