想用spring来管理struts2的action,因为还要向action中注入service,但用@Controller("/roleList")注解后,却找不到action了,这是为何喃?
import javax.annotation.Resource;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.xxx.action.BaseAction;
import com.xxx.common.bean.PaginationReturnBean;
import com.xxx.common.constant.ConstantDefine;
import com.xxx.common.security.Description;
import com.xxx.common.security.Privilege;
import com.xxx.manage.bean.RoleQueryBean;
import com.xxx.manage.entity.Role;
import com.bizex.manage.service.RoleService;
import com.opensymphony.xwork2.ModelDriven;
@Controller("/roleList")
@Scope("prototype")
@ParentPackage("manage")
@InterceptorRef("manageStack")
public class RoleListAction extends BaseAction implements ModelDriven {
@Resource(name = "roleService")
private RoleService roleService;
private static final long serialVersionUID = -3029290129233743984L;
private RoleQueryBean roleQueryBean = new RoleQueryBean();
private PaginationReturnBean<Role> roles = new PaginationReturnBean<Role>();// 查询角色列表的输出
@Action(results={@Result(location="manage/role_list.jsp")})
public String execute() throws Exception {
roles = roleService.getRoleList(roleQueryBean);
return SUCCESS;
}
public RoleQueryBean getModel() {
return roleQueryBean;
}
public PaginationReturnBean<Role> getRoles() {
return roles;
}
public void setRoles(PaginationReturnBean<Role> roles) {
this.roles = roles;
}
}