使用s2sh 整合了一个框架,但在写第一个示例时就出现了错误!
There is no Action mapped for namespace / and action name undefined. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:178)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)我并没有访问某一个action,只是到main.jsp就报这个错。
strtus.xml 放在src 下。<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"http://struts.apache.org/dtds/struts-2.1.7.dtd"><struts>
<constant name="struts.custom.i18n.resources" value="globalMessages" />
<constant name="struts.i18n.encoding" value="UTF-8" />
<constant name="struts.configuration.xml.reload" value="true"/>
<constant name="struts.devMode" value="true"/>
<!-- 把struts2的对象工厂设置为spring -->
<constant name="struts.objectFactory" value="spring"/>
<constant name="struts.ui.theme" value="simple"/>
<constant name="struts.enable.DynamicMethodInvocation" value="true" />
<constant name="struts.multipart.saveDir" value="/tmp"/>
<constant name="struts.multipart.maxSize" value="1000000000" />
<package name="my-default" namespace="/actions" extends="struts-default">
<!-- 测试用户 -->
<action name="userAction" class="userAction">
<result>/manage/user/index.jsp</result>
</action>
</package>
</struts>
There is no Action mapped for namespace / and action name undefined. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:178)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)我并没有访问某一个action,只是到main.jsp就报这个错。
strtus.xml 放在src 下。<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"http://struts.apache.org/dtds/struts-2.1.7.dtd"><struts>
<constant name="struts.custom.i18n.resources" value="globalMessages" />
<constant name="struts.i18n.encoding" value="UTF-8" />
<constant name="struts.configuration.xml.reload" value="true"/>
<constant name="struts.devMode" value="true"/>
<!-- 把struts2的对象工厂设置为spring -->
<constant name="struts.objectFactory" value="spring"/>
<constant name="struts.ui.theme" value="simple"/>
<constant name="struts.enable.DynamicMethodInvocation" value="true" />
<constant name="struts.multipart.saveDir" value="/tmp"/>
<constant name="struts.multipart.maxSize" value="1000000000" />
<package name="my-default" namespace="/actions" extends="struts-default">
<!-- 测试用户 -->
<action name="userAction" class="userAction">
<result>/manage/user/index.jsp</result>
</action>
</package>
</struts>
解决方案 »
- session 为空写入问题,自己写了一个过滤器获取session为空时写入处理
- 下载FTP服务器文件 但文件大小是0k
- snmp协议中pdu转发后源ip地址丢失问题,青高手赐教!!!
- 关于存储过程
- tomcat console打印出AbandonedObjectPool is used?
- 问一个简单的问题,Together要如何注册??
- 大哥谁知道哪里有WebLogic Server 7.0 下载? 在线等!!~谢谢
- struts初级问题
- 做J2EE和J2ME那个更又发展前途?欢迎讨论,发言又分!
- 小白求教 基础问题 不进controller的问题
- 怎样建立自己的代码库
- S2SH中包的组织问题
去掉namespace试试
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>main jsp</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>
<frameset rows="127,*,11" frameborder="no" border="0" framespacing="0">
<frame src="top.jsp" name="topFrame" scrolling="no" noresize="noresize" id="topFrame" />
<frame src="center.jsp" name="mainFrame" id="mainFrame" />
<frame src="down.jsp" name="bottomFrame" scrolling="no" noresize="noresize" id="bottomFrame" />
</frameset>
<body>
</body>
</html>这个是main.jsp 是一个frame
center.jsp<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'center.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"><style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
overflow:hidden;
}
-->
</style> </head>
<body>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8" bgcolor="#353c44"> </td>
<td width="200" valign="top">
<iframe height="100%" width="100%" border="0" frameborder="0" src="left.jsp" name="leftFrame" id="leftFrame" title="leftFrame"></iframe></td>
<td width="10" bgcolor="#add2da"> </td>
<td valign="top">
<iframe height="100%" width="100%" border="0" frameborder="0" src="right.jsp" name="rightFrame" id="rightFrame" title="rightFrame"></iframe></td>
<td width="8" bgcolor="#353c44"> </td>
</tr>
</table> </body>
</html>
left.jsp<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>left jsp</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">
<script type="text/javascript" src="js/TreeNode.js"></script>
<script type="text/javascript" src="js/Tree.js"></script>
<META content="MSHTML 6.00.2900.5848" name="GENERATOR">
<STYLE type="text/css" >
{
FONT-SIZE: 12px
}
#menuTree A {
COLOR: #566984; TEXT-DECORATION: none
}
</STYLE> </head>
<BODY style="BACKGROUND-POSITION-Y: -120px; BACKGROUND-IMAGE: url(images/bg.gif); BACKGROUND-REPEAT: repeat-x">
<TABLE height="100%" cellSpacing="0" cellPadding="0" width="100%">
<TBODY>
<TR>
<TD width="10" height="29"><IMG src="images/bg_left_tl.gif"></TD>
<TD
style="FONT-SIZE: 18px; BACKGROUND-IMAGE: url(images/bg_left_tc.gif); COLOR: white; FONT-FAMILY: system">Main
Menu</TD>
<TD width="10"><IMG src="images/bg_left_tr.gif"></TD>
</TR>
<TR>
<TD style="BACKGROUND-IMAGE: url(images/bg_left_ls.gif)"></TD>
<TD id="menuTree"
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-BOTTOM: 10px; PADDING-TOP: 10px; HEIGHT: 100%; BACKGROUND-COLOR: white"
vAlign="top">
</TD>
<TD style="BACKGROUND-IMAGE: url(images/bg_left_rs.gif)"></TD>
</TR>
<TR>
<TD width="10"><IMG src="images/bg_left_bl.gif"></TD>
<TD style="BACKGROUND-IMAGE: url(images/bg_left_bc.gif)"></TD>
<TD width="10"><IMG src="images/bg_left_br.gif"></TD>
</TR>
</TBODY>
</TABLE>
<SCRIPT type="text/javascript">
var tree = null;
var root = new TreeNode('系统菜单');
var fun1 = new TreeNode('人事管理');
var fun2 = new TreeNode('用户管理', 'actions/userAction', 'tree_node.gif', null, 'tree_node.gif', null);
fun1.add(fun2);
var fun3 = new TreeNode('部门管理', 'DepartmentMgr.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun1.add(fun3);
var fun4 = new TreeNode('员工管理', 'EmployeeMgr.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun1.add(fun4);
root.add(fun1);
var fun5 = new TreeNode('日程管理');
var fun6 = new TreeNode('我的日程', 'MySchedule.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun5.add(fun6);
var fun7 = new TreeNode('部门日程', 'DeptSchedule.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun5.add(fun7);
var fun8 = new TreeNode('我的便签', 'MyNote.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun5.add(fun8);
root.add(fun5);
var fun9 = new TreeNode('文档管理');
var fun10 = new TreeNode('文档管理', 'DocumentMgr.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun9.add(fun10);
var fun11 = new TreeNode('回收站', 'Recycler.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun9.add(fun11);
var fun12 = new TreeNode('文件搜索', 'FileSearch.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun9.add(fun12);
root.add(fun9);
var fun13 = new TreeNode('消息传递');
var fun14 = new TreeNode('消息管理', 'MessageMgr.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun13.add(fun14);
var fun15 = new TreeNode('信箱', 'MailBox.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun13.add(fun15);
root.add(fun13);
var fun16 = new TreeNode('系统管理');
var fun17 = new TreeNode('角色管理', 'RoleMgr.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun16.add(fun17);
var fun18 = new TreeNode('登录日志', 'LoginLog.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun16.add(fun18);
var fun19 = new TreeNode('操作日志', 'OperationLog.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun16.add(fun19);
var fun20 = new TreeNode('菜单排序', 'MenuSort.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun16.add(fun20);
root.add(fun16);
var fun21 = new TreeNode('考勤管理');
var fun22 = new TreeNode('签到签退', 'SignInOrOut.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun21.add(fun22);
var fun23 = new TreeNode('考勤查询', 'HistoryQuery.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun21.add(fun23);
var fun24 = new TreeNode('考勤统计', 'TimeStatistics.aspx', 'tree_node.gif', null, 'tree_node.gif', null);
fun21.add(fun24);
root.add(fun21);
tree = new Tree(root);
tree.show('menuTree')
</SCRIPT>
</BODY>
</html>right.jsp 只是一个列表页面,是静态的数据。没有什么操作!
center.jsp 包括 left.jsp 和right.jsp
top,down.jsp 也是静态的数据!没有操作!
// this.label.style.backgroundImage = "url(" + this.BG + ")";
向后台发前了一个请求,这个请求没有找到,所以出错。把这个注释了就可以了!
其他的原因,就是struts.xml 写的就问题,包括 dtd验证版本!