错误信息:
Struts Problem ReportStruts has detected an unhandled exception:
# Messages:  No result defined for action com.sum.FirstAction and result success
Stacktraces
No result defined for action com.sum.FirstAction and result success    com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:364)struts.xml:
<package name="struts2" namespace="/mystruts" extends="struts-default">
       
        <action name="sum" class="com.sum.FirstAction">
            <result name="positive">/positive.jsp</result>
            <result name="nagative">/nagative.jsp</result>
            <result name="SUCCESS">/index.jsp</result>
        </action>
    </package>web.xml:
<filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
sum.jsp

<%@ page language="java" import="java.util.*" pageEncoding="GBK" %>
  <%@ taglib prefix="s" uri="/struts-tags"%>
 
  <html>
      <head>
          <title>输入操作数</title>
      </head>
 
      <body>
           求代数和
          <br/>
          <s:form action="mystruts/sum.action" >               
              <s:textfield name="i" label=" 操作数1"/>
              <s:textfield name="j"  label=" 操作数2" />       
              <s:submit value="代数和" />           
          </s:form>
      </body>
  </html> 
positive.jsp
<html>
    <head>
      <title>显示代数和</title>
    </head>
   
    <body>   
      代数和为非负整数<h1><s:property value="sum" /></h1>
    </body>
  </html> 
nagative.jsp
<html>
    <head>
      <title>显示代数和</title>
    </head>
   
    <body>
      代数和为负整数<h1><s:property value="sum" /></h1>
     
    </body>
  </html> 

解决方案 »

  1.   

    就是求两个数的和 ,为正数返回到positive.jsp
    否则返回到nagative.jsp
      

  2.   

    No result defined for action com.sum.FirstAction and result success
    <result name="SUCCESS">/index.jsp</result> 
    Action类中的常量 SUCCESS 的值为:"success"
      

  3.   

    success 得是小写~~ 程序员 也得学英语啊~~
      

  4.   

    <result name="SUCCESS">/index.jsp</result>变成<result>/index.jsp</result>

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

  5.   

    <result name="SUCCESS">/index.jsp</result>改为:<result name="SUCCESS">index.jsp</result>
      

  6.   

    正解, 或者干脆不写. 默认就为success.!  或者不改这里的话 ,把你的action的方法返回值改为"SUCCESS"(有引号)~