67,513
社区成员
发帖
与我相关
我的任务
分享
严重: Servlet.service() for servlet jsp threw exception
java.lang.NoSuchMethodError: com.lyq.bean.TypeForm.getId()F
at org.apache.jsp.addressList_005flist_jsp._jspService(addressList_005flist_jsp.java:240)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at com.lyq.action.AddressListServlet.query(AddressListServlet.java:81)
at com.lyq.action.AddressListServlet.doPost(AddressListServlet.java:34)
at com.lyq.action.AddressListServlet.doGet(AddressListServlet.java:24)
package com.lyq.bean;
public class TypeForm {
public int id=0; //类别ID
public String typeName=""; //类别名称
public void setId(int id){
this.id=id;
}
public int getId(){
return id;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
}
//根据所属组ID查询联系人信息
public List<AddressListForm> query(int condition,String userEmail) {
List<AddressListForm> list = new ArrayList<AddressListForm>();
//String sql ="SELECT * FROM tb_addressList WHERE groupId=" + condition +" AND userEmail='"+userEmail+"'";
String sql ="SELECT * FROM tb_addressList WHERE groupId=" + condition +" AND userEmail='"+userEmail+"'";
ResultSet rs = conn.executeQuery(sql);
//System.out.println("SQL:"+sql);
try {
while (rs.next()) {
AddressListForm f = new AddressListForm();
f.setId(rs.getInt(1));
f.setName(rs.getString(2));
f.setEmail(rs.getString(3));
f.setBirthday(rs.getString(4));
f.setTel(rs.getString(5));
f.setGroupId(rs.getInt(6));
f.setUserEmail(rs.getString(7));
list.add(f); // 将联系人信息保存到List集合中
}
} catch (SQLException e) {
e.printStackTrace();
}
conn.close();
return list;
}
//查询全部联系人
public void query(HttpServletRequest request,HttpServletResponse response) throws IOException{
request.setAttribute("typeList",addressListDAO.queryType());
//将页面重定向到显示联系人列表页面
RequestDispatcher requestDispatcher = request.getRequestDispatcher("addressList_list.jsp");
try {
requestDispatcher.forward(request, response);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//删除联系人
public void del(HttpServletRequest request,HttpServletResponse response) throws IOException{
response.setContentType("text/html;charset=GBK");
int id=Integer.parseInt(request.getParameter("id"));
int rtn=addressListDAO.del(id);
//将页面重定向到联系人列表页面
if(rtn==0){
request.setAttribute("error","删除联系人信息失败!");
try {
request.getRequestDispatcher("error.jsp").forward(request,response);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
PrintWriter out = response.getWriter();
out.print("<script language=javascript>alert('删除联系人成功!');window.location.href='AddressList?action=query';</script>");
}
}
public void init() throws ServletException {
}
}
<%@ page contentType="text/html; charset=gbk" language="java" import="java.util.*" errorPage="" %>
<%@ page import="com.lyq.bean.AddressListForm"%>
<%@ page import="com.lyq.bean.TypeForm"%>
<%List<TypeForm> list=(List<TypeForm>)request.getAttribute("typeList");%>
<jsp:useBean class="com.lyq.dao.AddressListDAO" id="addressListDAO" scope="request"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<title>显示联系人列表</title>
<script language="javascript" src="JS/function.js"></script>
<link href="Css/style.css" rel="stylesheet">
<script language="javascript">
function del(para){
if(confirm("确定要删除该联系人信息吗?")){
window.location.href="AddressList?action=del&id="+para;
}
}
</script>
</head>
<body>
<%@include file="top.jsp"%>
<table width="777" height="328" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="166" valign="top" background="images/left_bg.GIF" class="tableBorder1">
<!--包含左侧文件-->
<%@include file="left.jsp"%>
</td>
<td valign="top" class="tableBorder"><table width="100%" height="320" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="4%" height="32" background="images/main_title.gif"> </td>
<td width="96%" background="images/main_title.gif" class="word_orange" style="padding-top:5px">当前位置:通讯录 > 查看联系人 >></td>
</tr>
<tr>
<td colspan="2" align="center" valign="top">
<table width="90%" height="40" border="0" cellpadding="0" cellspacing="0">
<tr><td height="9pt"></td></tr>
<%if(list.size()>0){%>
<%int m=1;
for(int i=0;i<list.size();i++){
List<AddressListForm> list_sub=(List<AddressListForm>)addressListDAO.query(list.get(i).getId(),session.getAttribute("username").toString());
out.println("<tr><td>");
if(list_sub.size()<1){
out.println(" <img src=\"images/jian_null.gif\" width=\"38\" height=\"16\" border=\"0\"> "+list.get(i).getTypeName()+"(0)");
}else{
out.println(" <a href=\"Javascript:ShowTR('img"+m+"',OpenRep"+m+")\"><img src=\"images/jia.gif\" border=\"0\" alt=\"展开\" id=\"img"+m+"\"></a> <a href=\"Javascript:ShowTR('img"+m+"',OpenRep"+m+")\">"+list.get(i).getTypeName()+"</a>("+list_sub.size()+")");
}
out.println("</td>");
if(list_sub.size()>0){%>
<tr id="OpenRep<%=m%>" style="display:none;">
<td colspan="6">
<%for(int j=0;j<list_sub.size();j++){%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25" align="center"><table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr onMouseOver="this.style.background='#F7F7F7'" onMouseOut="this.style.background=''" height="25px">
<td width="2%"> </td>
<td width="6%" class="tableBorder_b" align="center"><img src="images/folder.gif" width="16" height="16" border="0"> </td>
<td width="14%" class="tableBorder_b"><%=list_sub.get(j).getName()%></td>
<td width="34%" class="tableBorder_b"><%=list_sub.get(j).getEmail()%></td>
<td width="18%" class="tableBorder_b" align="center"><%="".equals(list_sub.get(j).getBirthday())?"-":list_sub.get(j).getBirthday()%></td>
<td width="20%" class="tableBorder_b" align="center"><%="".equals(list_sub.get(j).getTel())?"-":list_sub.get(j).getTel()%></td>
<td width="6%" class="tableBorder_b" align="right"><a href="#" onClick="del(<%=list_sub.get(j).getId()%>)">删除</a></td>
</tr>
</table></td>
</tr>
</table>
<%m++; //注意,该条语句一定不能少
}
out.println("</td>");
}
out.println("</tr>");
}
}%>
</table>
</td>
</tr>
</table></td>
</tr>
</table>
<%@ include file="copyright.jsp"%>
</body>
</html>
public class TypeForm {
private int id; //类别ID
private String typeName; //类别名称