type Exception reportmessagedescription The server encountered an internal error () that prevented it from fulfilling this request.exceptionorg.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 14 in the jsp file: /topic_add.jsp
The method topicAdds(Topic) is undefined for the type TopicDao
11:  int count = 0;
12:  TopicDao td = new TopicDaoImpl();
13:  if (topic != null) {
14:  td.topicAdds(new Topic(0,topic));
15:  }
16: %>
17: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">不管我怎么改 怎么写 那一行总是错 为什么

解决方案 »

  1.   

    他说的是你TopicDao方法里没有  topicAdds(Topic)的这个方法
    你去看看有没有这个名字的方法,有的话就看看这个方法签名是不是一致的
      

  2.   

    方法签名是参数吗 ?  TopicDao是接口 里面是有这个方法的。
    int topicAdds(Topic t); 实现Dao也有的
    public int topicAdds(Topic t) { int count=0;
    ResultSet rs=null;
    String sql="select count(*) from topic where tname=?";
    Object[] obj={t.getTopic()};
    rs=ExecuteQuery(sql, obj);
    try {
    if(rs.next()){
    count=rs.getInt(1);
    }
    if(count>=1){
    count=0;
    }else{
    sql="insert into topic values(topic_id_seq.nextval,?)";
    count=ExecuteUpdate(sql, obj);
    }
    return count;
    } catch (SQLException e) {

    e.printStackTrace();
    }finally{
    closeAll(conn, pstmt, rs);
    }

    return 0;
    }
      

  3.   

    你jsp的前边十几行代码都发出来看看
      

  4.   

    1、d.topicAdds(new Topic(0,topic));
    首先看看有没有Topic这个对象,或者看看有没有带参的Topic的构造方法,看有没有引用该Topic对象
    2、TopicDao td = new TopicDaoImpl();
    检查TopicDaoImpl对象里面有没有实现topicAdds(Topic)方法
      

  5.   

    <%@ page contentType="text/html; charset=GBK" language="java"
    import="java.sql.*,news.dao.*"%>
    <%@ page import="news.dao.impl.*"%>
    <%@ page import="news.entity.*"%>
    <%@ include file="file/loginControl.jsp"%>
    <%
    request.setCharacterEncoding("GBK");
    String topic = request.getParameter("topic");
    int count = 0;
    TopicDao td = new TopicDaoImpl();
    if (topic != null) {
    td.topicAdds(new Topic(0,topic));
    }
    %>
      

  6.   

    从这个jsp的代码看起来好像不应该报错啊
      

  7.   

    TopicDao td = new TopicDaoImpl();
    你把这句改成
    TopicDaoImpl td = new TopicDaoImpl();
    看看还会不会报错呢
      

  8.   

    我估计是服务器和MyEclipse没有同步