刚学struts2...遇到了一些问题。
部署运行了之后提示了如下错误警告: No configuration found for the specified action: 'save.action' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
2011-4-4 12:45:57 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [jsp] in context with path [/Struts 2.0] threw exception [tag 'radio', field 'list', name 'xs.xb': The requested list key '#{1:'男',2:'女' }' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]] with root cause
tag 'radio', field 'list', name 'xs.xb': The requested list key '#{1:'男',2:'女' }' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
我先把我的源码发出来
<%@ page language="java" import="java.util.*" 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">
<html>
  <head>
    <base href="<%=basePath%>">
   
    
    <title>My JSP 'stu.jsp' starting page</title>
    
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->  </head>
  
  <body>
        <h3>添加学生信息</h3>
        <s:form action="save.action" method="post" theme="simple">
        <table>
               <tr><td>学号:</td>
               <td><s:textfield name="xs.xh"></s:textfield> </td>
               </tr><tr><td>姓名:</td>
               <td><s:textfield name="xs.xm"></s:textfield></td>
               </tr><tr><td>性别:</td>
               <td><s:radio name="xs.xb" list="#{1:'男',2:'女' }" value="1"></s:radio></td>
               </tr><tr><td>专业:</td>
               <td><s:textfield name="xs.zy" label="专业"></s:textfield></td>
               </tr><tr><td width="70">出生时间:</td>
               <td><s:datetimepicker name="xs.cssj" id="cssj"
               displayFormat="yyyy-MM-dd"></s:datetimepicker></td>
               </tr><tr><td>备注:</td>
               <td><s:textarea name="xs.bz" label="备注"></s:textarea></td>
               </tr><tr><td><s:submit value="添加"></s:submit></td>
               </tr><tr><td><s:reset value="重置"></s:reset></td></tr>
        </table>
        </s:form>
  </body>
</html>

解决方案 »

  1.   

    你可以看下你的Struts.xml配置 action 了吗?若没配置,肯定找不到啊。 如以下配置。
             <action name="save" method="save" class="com.*">
               <result name="success">aa.jsp</result>
            </action> 
      

  2.   

    The requested list key '#{1:'男',2:'女' }' could not be resolved as a collection/array/map/enumeration/iterator type. 类型错误
    看看你 FORM里面xs.xb定义的是什么类型
      

  3.   

    把 xml 文件一起帖出来