哥哥 姐姐们 小弟 初学 不知道错哪了~~ 敬请大侠耐心讲解 真不知道错哪了 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;
}
}
解决方案 »
- 关于Java调用C#类对象问题
- 如何将${shop.shopName}之类的表达式语句类型转换成String类型(在线等待,急)
- 为什么把msbase.jar等3个包放到WEB-INF\lib中出现Cannot load JDBC driver class错误,而放到Tomcat的common\lib就没有问题呢?
- 问个JSP短信平台的问题
- 在jb2005中运行struts出现不知的错误,急,在线等待??????????????
- 求助!
- jsp 上传本地图片代码怎么写
- 关于dom解析
- 高手们,一定要帮小妹这个忙啊。(关于Access数据库转为SQL Server2000数据库后的问题)
- 天哪!!为什么会这样??
- 关于struts2.0validation的问题,谢谢
- jsp文件改html后缀,真的能改吗? 能!
=======================================================================
<form-bean name="studentform" type="edu.sduwebsite.struts.action.student.StudentAction"></form-bean>
不用加package
package edu.sduwebsite.struts.forms.student;
public class StudentAction extends DispatchAction
再次感谢~~~