No result defined for action and result

China☆狼群 提交于 2019-12-01 11:04:06

Nothing wrong with the struts configuration. What is wrong is that "noresult" result is not found in the action configuration. You have either configure a result or return a result code that you have in the action config such as SUCCESS for example.

public String noresult() throws Exception {         
    System.out.println("Hello How are you noresult() method got called.....");
    setMessage("noresult");
    return Action.SUCCESS;
}

What ever the string value your are returning from the action class method. You must declare a result name with the returned string value. example in your code:

Change

<result name="success">/noresultend.jsp</result>

to

<result name="noresult">/noresultend.jsp</result>

OR

You can add one more result in the action. like below

    <action name="noresultactionupdate" 
            class="leo.struts.HelloWorldAction" method="noresult">
      <result name="success">/noresultend.jsp</result>
     <result name="noresult">/noresultend.jsp</result>
      <result name="defaultdispatcher">/noresultdefaultdispatcher.jsp</result>
      </action> 

I hope It ll work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!