JSP页面
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<base href="<%=basePath%>">
<title>部门</title>
</head>
<body>
<form action="zy/find.action" method="post">
<table width="100%" border=1 cellspacing="0" >
<tr>
<th colspan="4" align="center">部门信息</th>
</tr>
<tr>
<th width="25%">部门编号</th>
<th width="25%" id="deptid">${deptid}</th>
<th width="25%">部门名称</th>
<th width="25%" id="deptname"><s:property value="deptname" /></th>
<tr>
</table>
<font size="3">员工信息:</font>
<a href="zy/dept_queryEmployeer?deptid=${deptid}&amp;deptname=${deptname}"><font size="3">查询</font></a>
<a href="zy/dept_addEmployeer?deptid=${deptid}&amp;deptname=${deptname}"><font size="3">增加</font></a>
<table width="100%" border=1 cellspacing="0">
<tr>
<th colspan="7" align="center">员工列表</th>
</tr>
<tr>
<th>员工编号</th>
<th>员工姓名</th>
<th>员工年龄</th>
<th>员工性别</th>
<th>员工薪资</th>
<th>部门标号</th>
<th>操作</th>
</tr>
<s:iterator value="list" var="employeer">
<tr>
<td align="center"><s:property value="#employeer.id" /></td>
<td align="center"><s:property value="#employeer.name" /></td>
<td align="center"><s:property value="#employeer.sex" /></td>
<td align="center"><s:property value="#employeer.age" /></td>
<td align="center"><s:property value="#employeer.salary" /></td>
<td align="center"><s:property value="#employeer.dept.id" /></td>
<td align="center">
<a href="zy/dept_updateEmployeer?employeer.id=${employeer.id}&amp;deptid=${deptid}&amp;deptname=${deptname}">修改</a>
<a href="zy/dept_deleteEmployeer?employeer.id=${employeer.id}&amp;deptid=${deptid}&amp;deptname=${deptname}">删除</a>
</td>
</tr>
</s:iterator>
</table>
</form>
<s:debug></s:debug>
</body>
</html>
----------------------------------------------------------------------------------------struts
-----------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="myPackage" namespace="/zy" extends="struts-default">

<action name="*_*" class="com.sansan.action.MyAction" method="{2}">
<result name="saveEmployeer">/index.jsp</result>
<result name="finddept">/WEB-INF/jsp/dept.jsp</result>
<result name="department">/WEB-INF/jsp/department.jsp</result>
<result name="departmentAndEmployeer">/WEB-INF/jsp/department.jsp</result>
<result name="updateEmployeer" >/WEB-INF/jsp/employeer.jsp</result>

</action>

<!-- <action name="save_employeer" class="com.sansan.action.MyAction" method="save_employeer">
<result name="saveEmployeer">/index.jsp</result>
</action> -->
</package>
</struts>----------------------------------------------------------------------------------------
public String saveEmployeer()
{
System.out.println(6666);
return "saveEmployeer";
}----------------------------------------------------------------------------------------
HTTP Status 404 - No result defined for action com.sansan.action.MyAction and result inputtype Status reportmessage No result defined for action com.sansan.action.MyAction and result inputdescription The requested resource is not available.
Apache Tomcat/7.0.77

解决方案 »

  1.   

    是namespacew
      

  2.   

    看到了,一般提交表单发生错误,默认是返回input,但是你没有配置input,所以才会有这样的错误提示,
    检查表单提交参数是否正确。
      

  3.   

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ taglib uri="/struts-tags" prefix="s" %>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <base href="<%=basePath%>">
    <title>设置</title>
    </head>
    <body><form action="zy/index_findDept" method="post">
    <table width="100%" border=1 cellspacing="0">
    <tr>
    <th colspan="6" align="center">员工信息</th>
    </tr>
    <tr >
    <th>员工编号</th>
    <th>员工姓名</th>
    <th>员工年龄</th>
    </tr>
    <tr>
    <td align="center"><input type="text"  name="id"  value="${employeer.id}" /></td>
    <td align="center"><input type="text"  name="name"  value="${employeer.name}" /></td>
    <td align="center"><input type="text"  name="age"  value="${employeer.age}" /></td>

    </tr>
    <tr>
    <th>员工性别</th>
    <th>员工薪资</th>
    <th>部门标号</th>
    </tr>
    <tr>
    <td align="center"><input type="text"  name="sex"  value="${employeer.sex}" /></td>
    <td align="center"><input type="text"  name="salary"  value="${employeer.salary}" /></td>
    <td align="center"><input type="text"  name="dept"  value="${employeer.dept.id}" /></td>
    </tr>
    <tr>
    <td colspan="2" align="center">修改信息</td>
    <td align="center">
    <input type="submit" value="保存">
    </td>
    </tr>
    </table></form><s:debug></s:debug>
    </body>
    </html>
      

  4.   


    有input输入框呀,这是为什么呢?
      

  5.   

    建议先用get方式提交,在浏览器url能看到提交的参数情况
    注意表单中字段属性与后台取值的字段属性是一致的。
      

  6.   


    有input输入框呀,这是为什么呢?

    这里说的input 不是说的input 输入框
    struts中,如果表单提交验证没过就返回input
    struts默认常量返回集中的一种。