哥哥 姐姐们 小弟 初学 不知道错哪了~~ 敬请大侠耐心讲解 真不知道错哪了 o(╯□╰)o
/////////tomcat 报错/////////
root cause 
javax.servlet.ServletException: Exception creating bean of class package edu.sduwebsite.struts.action.student.StudentAction: {1}
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.manage.score.index_jsp._jspService(index_jsp.java:273)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
edu.sduwebsite.utils.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:30)
//////////struts_config配置(截取有用的 路径没问题)
<form-bean name="studentform" type="package edu.sduwebsite.struts.action.student.StudentAction"></form-bean> <action path="/student"
type="edu.sduwebsite.struts.action.student.StudentAction"
scope="request"
name="studentform"
parameter="operation">
<forward name="indexstudent" path="/manage/score/index.jsp"></forward>
<forward name="addstudent" path="/manage/score/score-add.jsp"></forward>
<forward name="updatestudent" path="/manage/score/score-update.jsp"></forward>
<forward name="deletestudent" path="/manage/score/score-delete.jsp"></forward>
</action>
///继承的dispatchaction类
package edu.sduwebsite.struts.action.student;import java.util.List;
import java.util.Map;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;import edu.sduwebsite.domain.studentDomain.StudentDomain;
import edu.sduwebsite.entity.student.Student;
import edu.sduwebsite.struts.forms.student.StudentActionForm;public class StudentAction extends DispatchAction {
@SuppressWarnings("unchecked")
public ActionForward indexStudent(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
StudentActionForm actionform=(StudentActionForm) form;
StudentDomain sd = new StudentDomain();
String name="";
String num="";
int page=1;
if(request.getAttribute("STUDENT_PAGE")!=null)
page=Integer.parseInt(request.getAttribute("STUDENT_PAGE").toString());
if(null!=actionform){
if(actionform.getName()!=null)
name=actionform.getName();
if(actionform.getNum()!=null)
num=actionform.getNum();
}
Map<String, Object> result = sd.getStudents( name, num, 10, page);
List<Student> stu_list=(List<Student>) result.get("STU_LIST");
int test=Integer.parseInt(result.get("STU_NUM").toString());
if (test > 0){
request.setAttribute("STUDENT_LIST", stu_list);
request.setAttribute("STUDENT_NUM", test);
}
return mapping.findForward("indexstudent");
}}
/////继承actionform类
package edu.sduwebsite.struts.forms.student;import org.apache.struts.action.ActionForm;public class StudentActionForm extends ActionForm { private static final long serialVersionUID = 1L; private String id; private String num; private String name; private String traintype; private String enroll_type; private String enroll_s_type; private String recorder; private String date;

public StudentActionForm() {
super();
this.id = "";
this.num = "";
this.name = "";
this.traintype = "";
this.enroll_type = "";
this.enroll_s_type = "";
this.recorder = "";
this.date = "";
}

public StudentActionForm(String id, String num, String name, String traintype, String enroll_type, String enroll_s_type, String recorder, String date) {
super();
this.id = id;
this.num = num;
this.name = name;
this.traintype = traintype;
this.enroll_type = enroll_type;
this.enroll_s_type = enroll_s_type;
this.recorder = recorder;
this.date = date;
} /**
 * @return the date
 */
public String getDate() {
return date;
} /**
 * @param date the date to set
 */
public void setDate(String date) {
this.date = date;
} /**
 * @return the enroll_s_type
 */
public String getEnroll_s_type() {
return enroll_s_type;
} /**
 * @param enroll_s_type the enroll_s_type to set
 */
public void setEnroll_s_type(String enroll_s_type) {
this.enroll_s_type = enroll_s_type;
} /**
 * @return the enroll_type
 */
public String getEnroll_type() {
return enroll_type;
} /**
 * @param enroll_type the enroll_type to set
 */
public void setEnroll_type(String enroll_type) {
this.enroll_type = enroll_type;
} /**
 * @return the id
 */
public String getId() {
return id;
} /**
 * @param id the id to set
 */
public void setId(String id) {
this.id = id;
} /**
 * @return the name
 */
public String getName() {
return name;
} /**
 * @param name the name to set
 */
public void setName(String name) {
this.name = name;
} /**
 * @return the num
 */
public String getNum() {
return num;
} /**
 * @param num the num to set
 */
public void setNum(String num) {
this.num = num;
} /**
 * @return the recorder
 */
public String getRecorder() {
return recorder;
} /**
 * @param recorder the recorder to set
 */
public void setRecorder(String recorder) {
this.recorder = recorder;
} /**
 * @return the traintype
 */
public String getTraintype() {
return traintype;
} /**
 * @param traintype the traintype to set
 */
public void setTraintype(String traintype) {
this.traintype = traintype;
}
}

解决方案 »

  1.   

    <form-bean name="studentform" type="edu.sduwebsite.struts.forms.student.StudentActionForm"></form-bean> 
      

  2.   

    <form-bean name="studentform" type="package edu.sduwebsite.struts.action.student.StudentAction"></form-bean> 
    =======================================================================
    <form-bean name="studentform" type="edu.sduwebsite.struts.action.student.StudentAction"></form-bean>
    不用加package
      

  3.   

    <form-bean name="studentform" type="edu.sduwebsite.struts.action.student.StudentAction"></form-bean>改过了 还是不行 ~~
      

  4.   

    form-bean和action用的是一个?
    package edu.sduwebsite.struts.forms.student;
    public class StudentAction extends DispatchAction 
      

  5.   

    谢谢了 还是路径名不对 把action的路径 写到 form-bean里面了 我还是菜 还不细心 让大家费心了 
    再次感谢~~~