日期:2014-05-17  浏览次数:20625 次

HTTP StatusHTTP Status 404 - No result defined for action and result input
Struts2的这个Error,我在网上也搜了一下,一大堆,大概都是说配置result input的,但我还是没有达到要求。说一下我的应用,发布公告模块,Action交由Spring管理,
struts.xml:
<action name="newNotifyAction" class="newNotifyAction"
  method="saveOrLoadNotify">
<result name="success" type="redirect-action">
action/notifyListAction.action
</result>
</action>(注:这个是要跳转到另一Action的,在其他地方有用过,是没有问题的。)
Action方法:
public String saveOrLoadNotify() {
try {
log.info("是否短訊息提醒:"+this.notify.getSmsRemind());
if ("save".equals(this.operate)) { //保存
this.notify.setNotiPublish("1");
this.editSaveContent();
} else if ("release".equals(this.operate)) { //发布
this.notify.setNotiPublish("0");
this.editSaveContent();
if (this.notify.getSmsRemind().equals("0")) {
this.sendSms();
}
}
return SUCCESS;
} catch (Exception e) {
log.error(e.getMessage());
this.addActionMessage("執行新建公告操作失敗!");
return ERROR;
}
}

spring 注入Service接口:
<bean id="newNotifyAction"
class="com.eberp.notify.action.NewNotifyAction" scope="prototype">
<property name="notifyService">
<ref bean="notifyService" />
</property>
<property name="ebHrService">
<ref bean="ebHrService" />
</property>
<property name="smsService">
<ref bean="smsService" />
</property>
</bean>

页面调用:
<s:form name="form" action="newNotifyAction" method="post"
  enctype="multipart/form-data" theme="simple" onsubmit="return CheckForm();">

……(这里有标题,内容(内容是嵌入文本编辑器的,),时间等字段属性)
<s:submit cssClass="BigButton" value="發布" onclick="return doDisposeNotify('release');"></s:submit>
&nbsp;&nbsp;
<s:submit cssClass="BigButton" value="保存" onclick="return doDisposeNotify('save');"></s:submit>

这样提交一直是
HTTP Status 404 - No result defined for action com.eberp.notify.action.NewNotifyAction and result input
当我添加了<result name="input">/notify/newnotify.jsp</result>后,当我提交表单就直接跳回到newnotify.jsp,通过设置断点,看到根本没有进入我的Action方法。
各位,我弄了一天多的时间了,到现在还没搞定,很少郁闷。请大家积极给予好的解决方法.谢谢!



------解决方案--------------------
路径的问题
------解决方案--------------------
404 路径错误

Java code

当我添加了 <result name="input">/notify/newnotify.jsp </result>后,当我提交表单就直接跳回到newnotify.jsp,通过设置断点,看到根本没有进入我的Action方法。

------解决方案--------------------
肯定能是路径问题的 好好看路径吧 action的路径
------解决方案--------------------
<action name="newNotifyAction" class="newNotifyAction" 
method="saveOrLoadNotify">

class里面应该写Action的绝对路径吧 把包都加进去 如:com.xxxx.xxxx.newNotifyAction
------解决方案--------------------
检查你的struts.xml吧 应该是那里配置错了
------解决方案--------------------
404路径出错。

500代码异常。.
------解决方案--------------------
楼主问题解决了吗? 我的问题和楼主的一样,很郁闷啊,急啊。