insertConnect.jsp页面的错误提示:
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Exception creating bean of class com.yourcompany.struts.InsertAction: {1}
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.insertConnect_jsp._jspService(insertConnect_jsp.java:88)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
root cause
javax.servlet.jsp.JspException: Exception creating bean of class com.yourcompany.struts.InsertAction: {1}
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:563)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:520)
org.apache.jsp.insertConnect_jsp._jspx_meth_html_form_0(insertConnect_jsp.java:118)
org.apache.jsp.insertConnect_jsp._jspService(insertConnect_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs.
_________________________________________________________________________________
insertAction.java如下:
package com.yourcompany.struts;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
/**
* <strong>InsertAction</strong> inserts a new record into the database.
*/
public final class InsertAction extends Action{
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
String name=null;
String phone=null;
String address=null;
name = ((InsertForm) form).getName();
phone=((InsertForm)form).getPhone();
address=((InsertForm)form).getAddress();
try
{
AddressBookBean bean=new AddressBookBean(name,phone,address);
bean.insert();
}
catch(Exception ex)
{
ex.printStackTrace();
}
return mapping.findForward("insert");
}
}
_________________________________________________
那位大侠告诉小弟,如何做呀?谢谢!
你没有把AddressBookBean这个类导入进来所以找不到赶紧把它导入就OK了