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">不管我怎么改 怎么写 那一行总是错 为什么
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">不管我怎么改 怎么写 那一行总是错 为什么
解决方案 »
- 我疯了!!!!!项目丢失
- 一个小小的问题。。不知道有解决的方法不。
- 有什么不同?
- XMLHTTP问题(求教)帮顶有分
- 100分求!采用JAVA技术,已知某网页网址,如www.sina.com.cn/index.html,如何将其生成图片快照?
- 关于TAG的问题,请指点
- 怎么确保只打开一个窗口??
- 很菜的问题,大家帮帮忙(附源码)!!
- 求提供思路,如何解决批量注册账号对方接口限制IP注册频率这个问题
- Servlet怎么获得JSP表格中复选框选中的行的所有列值
- 用myeclipse新建JSP文件时自动添加的一些代码问题
- struts2关于request,session,application传值与显示的问题
你去看看有没有这个名字的方法,有的话就看看这个方法签名是不是一致的
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;
}
首先看看有没有Topic这个对象,或者看看有没有带参的Topic的构造方法,看有没有引用该Topic对象
2、TopicDao td = new TopicDaoImpl();
检查TopicDaoImpl对象里面有没有实现topicAdds(Topic)方法
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));
}
%>
你把这句改成
TopicDaoImpl td = new TopicDaoImpl();
看看还会不会报错呢