我现在写的几个相关查询都报这个错怎么回事?org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 108 in the jsp file: /AddressBook/b_nameall.jsp
The method getAllAddressPlus1(String) is undefined for the type AddressDao
105:  String birthday=request.getParameter("birthday");
106:  String phone=request.getParameter("phone");
107:  name=new String(request.getParameter("name").getBytes("iso-8859-1"),"gb2312");
108:  ArrayList<Address> aList1=aDao.getAllAddressPlus1(name);
109:   %>
110:  <body bgcolor="#efefef">
111:  <%
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 9 in the generated java file
Only a type can be imported. smartmt.model.mms.MmsA resolves to a packageAn error occurred at line: 25 in the jsp file: /mmstest/mmsstatu.jsp
MmsA cannot be resolved to a type
22:  }
23: 
24:  MmsDao mms=new MmsDao(DataSourceFactory.getDataSource());
25:  List<MmsA> aList=mms.getMmsall(userId);
26:  %>
27:  <body bgcolor="#efefef">
28: 
怎么找都找不到错误的原因请大侠们指点。

解决方案 »

  1.   

    附上第二个错误的代码DAO的代码
    public List<MmsA> getMmsall()
    {
    ArrayList<MmsA> aList=new ArrayList<MmsA>();
    String sql="select phone,sendTime,statu from plat_mms_history "; List tbl = dbexec.queryForList(sql);
    Iterator it = tbl.iterator();
    while(it.hasNext()) {
    MmsA mms = new MmsA();
    Map rec = (Map)it.next();
    mms.setPhone((String)rec.get("phone"));
    mms.setSendTime((Timestamp)rec.get("sendTime"));
    mms.setStatu((String)rec.get("statu"));
    aList.add(mms);
    }
    return aList;code
    }JSP页面代码
    <%@ page contentType="text/html; charset=gbk"%>
    <%@page import="smartmt.db.DataSourceFactory"%>
    <%@page import="java.util.List"%>
    <%@page import="smartmt.db.MmsDao"%><%@page import="smartmt.model.mms.MmsA"%>
    <%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
    <html>
    <head>
    <title>.</title>
    </head>
    <%
    Long userId = (Long) session.getAttribute("userId");
    if (userId == null) {
    %><script>top.window.location.href='../index.htm'</script>
    <%
    return;
    }

    MmsDao mms=new MmsDao(DataSourceFactory.getDataSource());
    List<MmsA> aList=mms.getMmsall();
    %>
    <body bgcolor="#efefef">



    <form id="addrForm" method="get" action="manual.jsp">
    <%
    request.setAttribute("aList", aList);
    %>
    <display:table name="aList" pagesize="20" id="dis">
    <display:column property="phone" title="手机号码" />
    <display:column property="sendTime" title="发送时间" />
    <display:column property="statu" title="发送状态" />
    </display:table>
    </form>
    </body>


    </html>
      

  2.   

    从你的错误上看. 第一个错误是说
    AddressDao类中没有定义getAllAddressPlus1(String)这个方法
    第二个是没有导包的原因!LZ仔细点检查你的代码吧
      

  3.   

    第一个问题:没有定义getAllAddressPlus1(String)
    第二个: MmsA  这个类型 你没有定义
      

  4.   


    可是都有啊。我把代码在贴一遍你们看。public List getresult() { String sql = "select phone,sendTime,statu from plat_mms_history";

    List tbl =  dbexec.queryForList(sql);
    Iterator it = tbl.iterator();
    ArrayList<HashMap<String, String>> List = new ArrayList<HashMap<String, String>>();
    try {
    while(it.hasNext()) {
    Map rec = (Map)it.next();
    HashMap<String, String> hashRec = new HashMap<String,String>();
    hashRec.put("phone", (String)rec.get("phone"));
    hashRec.put("sendTime", "" +(Timestamp)rec.get("sendTime"));
    hashRec.put("statu", (String)rec.get("statu"));
    List.add(hashRec);
    }
    } catch(Exception e) {
    System.out.println("检索失败!" + e.getMessage());
    return null;
    }
    return List;
    }}

    <%@ page contentType="text/html; charset=gbk"%>
    <%@page import="smartmt.db.DataSourceFactory"%>
    <%@page import="java.util.List"%>
    <%@page import="smartmt.db.MmsDao"%><%@ page import="java.sql.*" %>
    <%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
    <html>
    <head>
    <title>.</title>
    </head>
    <%
    Long userId = (Long) session.getAttribute("userId");
    if (userId == null) {
    %><script>top.window.location.href='../index.htm'</script>
    <%
    return;
    }

    MmsDao mms=new MmsDao(DataSourceFactory.getDataSource());
    List List=mms.getresult();
    %>
    <body bgcolor="#efefef">



    <form id="addrForm" method="get" action="manual.jsp">
    <%
    request.setAttribute("List", List);
    %>
    <display:table name="List" pagesize="20" id="dis">
    <display:column property="phone" title="手机号码" />
    <display:column property="sendTime" title="发送时间" />
    <display:column property="statu" title="发送状态" />
    </display:table>
    </form>
    </body>


    </html>
      

  5.   

    1:The method getAllAddressPlus1(String) is undefined for the type AddressDaoAddressDao类中没有getAllAddressPlus1这个方法;2:Only a type can be imported. smartmt.model.mms.MmsA resolves to a package说你import的是一个包,不是类
    <%@page import="smartmt.model.mms.MmsA"%>
    smartmt.model.mms.MmsA是一个路径?