struts2问题 后台报错(对前台没有什么影响) 大家帮忙看看

lsq1988512 2010-09-28 10:33:37
struts.xml配置文件:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<package name="default" namespace="" extends="struts-default">
<action name="organizationTree" class="com.iss.framework.action.CountryAction" method="organizationTree">
<result name="success">/countryTreeList.jsp</result>
</action>
<action name="organizationIntoViewAction" class="com.iss.framework.action.CountryAction" method="viewAction">
<result>/countryDetail.jsp</result>
</action>

</package>
</struts>


报错信息:
2010-9-28 10:29:47 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
警告: Could not find action or result
There is no Action mapped for namespace / and action name null. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177)
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)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
...全文
178 19 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
lsq1988512 2010-09-28
  • 打赏
  • 举报
回复
不好意思 ,打扰大家了 问题找到了 不是struts的问题 是公司系统js的问题 我的closeInputWindow()方法是关闭我打开页面的iframe窗体的。。
lsq1988512 2010-09-28
  • 打赏
  • 举报
回复
[Quote=引用 14 楼 shanxmxj 的回复:]
namespace是包的命名空间
没有这个怎么访问action
访问action的时候
不得是 localhost:端口号/webroot/namespace/xx.Action
[/Quote]

没有namespace的话代表默认为空
访问action的路径为 /webroot/xx.Action
zhy0511 2010-09-28
  • 打赏
  • 举报
回复
楼主那个closeInputWindow();函数从哪知道的?只是要关闭窗口吗?还是需要做别特殊的操作?如果只是要关闭窗口改成close();试试。.
shanxmxj 2010-09-28
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 lsq1988512 的回复:]
我一点关闭按钮页面就刷新 后台就报这个错.
[/Quote]
是不是在刷新这个页面的时候 没有找到对应的action

把显示这个页面的action贴出来看下
zhy0511 2010-09-28
  • 打赏
  • 举报
回复
window.parent.closeInputWindow();

我怎么没找到closeInputWindow();方法啊
shanxmxj 2010-09-28
  • 打赏
  • 举报
回复
namespace是包的命名空间
没有这个怎么访问action
访问action的时候
不得是 localhost:端口号/webroot/namespace/xx.Action
lsq1988512 2010-09-28
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 shanxmxj 的回复:]
Java code
<package name="default" namespace="" extends="struts-default">

namespace没有给
[/Quote]
这跟namespace有关系吗?
lsq1988512 2010-09-28
  • 打赏
  • 举报
回复
我也没有提交action啊..
shanxmxj 2010-09-28
  • 打赏
  • 举报
回复
<package name="default" namespace="" extends="struts-default">

namespace没有给
zhy0511 2010-09-28
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 lsq1988512 的回复:]

主要是我前台没有提交action 页面刷新了 就报这个错..
[/Quote]

那你可以设置它刷新但是不提交action啊,用javascript,为什么要刷新页面呢?
lsq1988512 2010-09-28
  • 打赏
  • 举报
回复
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
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 'countryDetail.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">
-->
<link rel="stylesheet" href="skin/css/page.css"
type="text/css" />
<link rel="stylesheet" href="skin/css/style.css"
type="text/css" />
<link rel="stylesheet"
href="css/window_css/window.css" type="text/css" />
<!-- 日期控件js -->
<script type="text/javascript"
src="js/popcalendar.js"/> </script>
<!--数据验证,转换js -->
<script type="text/javascript" src="js/check.js"/></script>
<script type="text/javascript" src="js/common.js"/></script>
<!--放大镜要用到的js -->
<script type="text/javascript" src="js/prototype.js"/> </script>
<script type="text/javascript" src="js/drag.js"/> </script>
<script type="text/javascript" src="js/json.js"/> </script>
<script type="text/javascript" src="js/zoom.js"/> </script>
<!--弹出窗口的js-->
<script type="text/javascript" src="js/window_js/window.js"/> </script>
<script type="text/javascript">
function closeWindow(){
window.parent.closeInputWindow();
}
</script>
</head>

<body>

<p>

</p>
<input type="button" value="关闭" onclick="closeWindow()" class="buttonStyle"><br>
ID:${country.id } <br>
名称:${country.name }<br>
</body>
</html>

我一点关闭按钮页面就刷新 后台就报这个错.

shanxmxj 2010-09-28
  • 打赏
  • 举报
回复

贴页面访问后台的代码

好好检查下你的代码 jsp->struts.xml ->Action 看看哪里配错了
a1018615265 2010-09-28
  • 打赏
  • 举报
回复
com.iss.framework.action.CountryAction 这个里面有个方法organizationTree()返回值是success,然后你的success映射到一个结果result上,执行显示的页面countryTreeList.jsp

这是ACTION的执行过程, Could not find action or result
There is no Action mapped for namespace / and action name null. - [unknown location
你的ACTION 映射找不到 result ,你看下你自己的配置,或是删掉一个Action留一个action来测试一下
lsq1988512 2010-09-28
  • 打赏
  • 举报
回复
主要是我前台没有提交action 页面刷新了 就报这个错..
zhy0511 2010-09-28
  • 打赏
  • 举报
回复
把你提交action的代码贴出来看看吧!
zhy0511 2010-09-28
  • 打赏
  • 举报
回复
是不是提交的时候没写action 名字?
小武茶庄 2010-09-28
  • 打赏
  • 举报
回复

Could not find action or result
There is no Action mapped for namespace / and action name null. - [unknown location]

应该是你的action名字写错了,找不到这个action name啊.
tianshi1017 2010-09-28
  • 打赏
  • 举报
回复
贴一下你前台的(JSP)提交的代码撒
freedomTTT 2010-09-28
  • 打赏
  • 举报
回复
action name 名字写错了吧

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧