刚学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>
部署运行了之后提示了如下错误警告: 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>
解决方案 »
- struts1 登录验证的问题 通过监听来实现!!!
- 如何用代码实现点击事件
- 首页左栏显示不出来
- 动态调用action
- jsp文件放在文件夹里怎么用tomcat访问
- Struts1.x 使用<logic:iterate><logic:iterate> 遇到Cannot find bean:
- ORA-01000: 超出打开游标的最大数 我应该如何关闭游标?我都使用了rs.close();可是还是不行呀……到底怎么了?
- 请问使用JTable时如何插入一行?
- 怎样修改xml的节点的值?
- springMVC 使用json出错java.sql.SQLException: Positioned Update not supported.
- 关于JavaScript,客户端判断提交是否为空值的问题...
- properties文件插入数据
<action name="save" method="save" class="com.*">
<result name="success">aa.jsp</result>
</action>
看看你 FORM里面xs.xb定义的是什么类型