princehyderabad
asked on
find USERID error in JSP
hi experts,
I have jsp which call itself and check certain condition and displays record. If I search by userid, it shows me correct record
<%
if (request.getParameter.equa ls("Y"))
{
String getUserId = request.getParameter("user id");
...
..
sb.append(" AND UPPER(USERID) LIKE UPPER('"+getUserId+any+"') ");
...
..
rs= stmt.executeQuery(sb.toStr ing());
..
while (rs.next())
{
...
}
}
%>
worked fine. Now I added condition if no userid exist display msg. "No users to display". If I type wrong ID it does display msg. But when I type correct ID I'm not getting the record display nor do I'm getting error. Seems like logic error after adding that if (!rs.next())
<%
if (request.getParameter.equa ls("Y"))
{
String getUserId = request.getParameter("user id");
...
..
sb.append(" AND UPPER(USERID) LIKE UPPER('"+getUserId+any+"') ");
...
..
rs= stmt.executeQuery(sb.toStr ing());
..
if(!rs.next())
{
out.print("No users to display");
}
while (rs.next())
{
...
}
}
%>
Thx.
PH
I have jsp which call itself and check certain condition and displays record. If I search by userid, it shows me correct record
<%
if (request.getParameter.equa
{
String getUserId = request.getParameter("user
...
..
sb.append(" AND UPPER(USERID) LIKE UPPER('"+getUserId+any+"')
...
..
rs= stmt.executeQuery(sb.toStr
..
while (rs.next())
{
...
}
}
%>
worked fine. Now I added condition if no userid exist display msg. "No users to display". If I type wrong ID it does display msg. But when I type correct ID I'm not getting the record display nor do I'm getting error. Seems like logic error after adding that if (!rs.next())
<%
if (request.getParameter.equa
{
String getUserId = request.getParameter("user
...
..
sb.append(" AND UPPER(USERID) LIKE UPPER('"+getUserId+any+"')
...
..
rs= stmt.executeQuery(sb.toStr
..
if(!rs.next())
{
out.print("No users to display");
}
while (rs.next())
{
...
}
}
%>
Thx.
PH
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER