could not find action or result 困扰一上午了,求指教
一 struts.xml文件
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true"></constant>
<constant name="struts.action.extension" value="action"></constant>
<!-- Overwrite Convention -->
<package name="oa_project" extends="struts-default" namespace="/">
<!-- 配置岗位管理Action -->
<action name="roleAction_*" class="roleAction" method="{1}">
<result name="list">/WEB-INF/jsp/roleAction/list.jsp</result>
<result name="addUI">/WEB-INF/jsp/roleAction/addUI.jsp</result>
<result name="editUI">/WEB-INF/jsp/roleAction/editUI.jsp</result>
<result name="toList" type="redirectAction">roleAction_list</result>
</action>
</package>
</struts>
二、Action文件
package wang.oa.view.action;
import java.util.List;
import javax.annotation.Resource;
import com.opensymphony.xwork2.ActionSupport;
import wang.oa.domain.Role;
import wang.oa.service.RoleService;
public class RoleAction extends ActionSupport {
@Resource(name = "roleServiceImpl")
private RoleService roleService;
// 声明roleList,并生成get方法,list方法中赋值后,可以自动装入值栈中
private List<Role> roleList;
public List<Role> getRoleList() {
return roleList;
}
// 声明id,并生成get set方法,使用属性封装
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/**
* 列表
*
* @return
* @throws Exception
*/
public String list() throws Exception {
roleList = roleService.findAll();
return "list";
}
/**
* 删除
*
* @return
* @throws Exception
*/
public String delete() throws Exception {
roleService.delete(id);
return "toList";
}
/**
* 添加页面
*
* @return
* @throws Exception
*/
public String addUI() throws Exception {
// TODO Auto-generated method stub
return "addUI";
}
/**
* 添加
*
* @return
* @throws Exception
*/
public String add() throws Exception {
return "toList";
}
/**
* 修改页面
*
* @return
* @throws Exception
*/
public String editUI() throws Exception {
// TODO Auto-generated method stub
return "editUI";
}
/**
* 修改
*
* @return
* @throws Exception
*/
public String edit() throws Exception {
// TODO Auto-generated method stub
return "toList";
}
}
我在浏览器 输入访问list这个方法就可以访问到数据库,也可以正确返回列表
输入delete方法带一个参数id也可以直接删除
但是addUI怎么访问都提示标题的问题。
http://localhost:8080/OA_ssh_proj/roleAction_list.action 这样写 可以正确找到并返回list
http://localhost:8080/OA_ssh_proj/roleAction_addUI.action 这样写 就报错
struts配置文件的位置没问题,所有的jsp页面也都建立了,位置也正确
很奇怪,为什么访问不到呢?