错误信息是这个
我的action中这样写的
<!-- 增加学生的方法 -->
<action name="addStudentAction" class="addStudentAction" method="addStudentAction">
<result name="success" type="redirect">student.jsp</result>
<result name="error">error.jsp</result>
</action>
action代码这样的
package com.yzj.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.opensymphony.xwork2.ActionSupport;
import com.yzj.model.Student;
import com.yzj.service.StudentService;
@Component("studentAction")
@Scope("prototype")
public class StudentAction extends ActionSupport {
HttpServletRequest request;
private StudentService studentService;
private String username;
private List<Student> student;
private Student stu;
public Student getStu() {
return stu;
}
public void setStu(Student stu) {
this.stu = stu;
}
public HttpServletRequest getRequest() {
return request;
}
public void setRequest(HttpServletRequest request) {
this.request = request;
}
public List<Student> getStudent() {
return student;
}
public void setStudent(List<Student> student) {
this.student = student;
}
public StudentService getStudentService() {
return studentService;
}
public void setStudentService(StudentService studentService) {
this.studentService = studentService;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String findAllStudent() {
System.out.println("000000000000000");
student = studentService.findAllStudent();
System.out.println("111111111111111111");
if (student != null && student.size() > 0 ) {
return "success";
}
return "error";
}
}
不知道怎么回事,求大神!!
配置action的class应该是完整的类名。
你这样配置没报错吗? class应该是配置你映射的类路径吧
类名写错了
配置action的class错了。一个打酱油路过的围观群众
应该加上class域名
你这样的话,struts的action要交给spring管理,,看下你的spring配置文件怎么写的
是spring的问题