为什么会有这种错误?javax.servlet.ServletException: Attempt to coerce a value of type "[Ljava.util.SortedMap;" to type "java.lang.Long"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
代码如下:username,password 为表单传递过来的数据。
<%@ page language="java" buffer="32kb" %>
<%@ page language="java" contentType="text/html; charset=gb2312" %>
<%@include file="/datasource.inc"%>
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>登陆验证</title>
</head>
<body bgcolor="#FFFFFF">
       <sql:query var="query1" dataSource="${base}">  
               select * from Users where name=? and password=?
               <sql:param value="${param.username}"/>
               <sql:param value="${param.password}"/>
       </sql:query>
       <c:url var="ul" value="index.jsp"></c:url>
       <c:if test="${query1.rows>0}" >
             
             <c:redirect url="${ul}"></c:redirect>        
       </c:if>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
数据库表名为:Users
字段为:name                    varchar   30
        password                varchar   20
        password

解决方案 »

  1.   

    一个月以前提的问题现在觉得好幼稚呀!
    嘎嘎~!
    <%@ page language="java" buffer="32kb" %>
    <%@ page language="java" contentType="text/html; charset=gb2312" %>
    <%@include file="/datasource.inc"%>
    <!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
    <html>
    <head>
    <title>登陆验证</title>
    </head>
    <body bgcolor="#FFFFFF">
           <sql:query var="query1" dataSource="${base}">  
                   select * from Users where name=? and password=?
                   <sql:param value="${param.username}"/>
                   <sql:param value="${param.password}"/>
           </sql:query>
           <c:url var="ul" value="index.jsp"></c:url>
           <c:if test="${<%@ page language="java" buffer="32kb" %>
    <%@ page language="java" contentType="text/html; charset=gb2312" %>
    <%@include file="/datasource.inc"%>
    <!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
    <html>
    <head>
    <title>登陆验证</title>
    </head>
    <body bgcolor="#FFFFFF">
           <sql:query var="query1" dataSource="${base}">  
                   select * from Users where name=? and password=?
                   <sql:param value="${param.username}"/>
                   <sql:param value="${param.password}"/>
           </sql:query>
           <c:url var="ul" value="index.jsp"></c:url>
           <c:if test="${query1.rowCount>0}" >
                 
                 <c:redirect url="${ul}"></c:redirect>        
           </c:if>
    </body>
    </html>
    >0}" >
                 
                 <c:redirect url="${ul}"></c:redirect>        
           </c:if>
    </body>
    </html>rowCount这样才对呵呵~!