我的配置是这样的
环境是struts2.0 spring2.5 hibernate3
环境配置没问题
struts.xml中<action name="addCart" class="shoppingAction" method="addToCart">
     <result name="success">/jsp/addToCart_success.jsp</result>
</action>applicationContext.xml 中<bean id="shoppingAction" class="com.action.ShoppingAction" scope="prototype">
    <property name="bookService">
<ref bean="bookService"/>
    </property>
</bean>客户端代码
<s:form action="addCart" method="post">
<s:textfield name="quantity" value="0" size="4" label="数量:"></s:textfield>
<s:hidden name="bookid" value="<s:property value='#book.bookid'/>"></s:hidden>
<s:submit value="加入购物车"></s:submit>
</s:form>项目中其他这样类似的代码都是运行正常的
一到这里就出现
HTTP Status 404 - No result defined for action com.action.ShoppingAction and result input
错误
困扰我两天了在线等。。

解决方案 »

  1.   

      目前发现这个问题主要是在Action中的execute返回值时,没有对于的result name而引起的。很有可能是由于程序执行中出错了,但是对应的Action中没有添加 input的result name的导致的。尝试的解决方案是在发生的错误的Action上添加<result name=”input”>/error.jsp</result>当然,这个error.jsp是用来显示错误的,若想查看具体的错误信息,可以在error.jsp中添加<div style=”color:red;”><s:fielderror/></div>s是taglib的prefix。
    http://stephenchenit.spaces.live.com/Blog/cns!B76A124933E17FC7!285.entry.............................................http://hi.baidu.com/ggstudyblog/blog/item/069f200362af908dd53f7c37.html今天发现了这个异常,后经过检查才知道,产生这个异常的原因是因为struts.xml里配置文件时,少配置了<result name="input">/upload.jsp</result>
    这一行才导致的错误!<action name="upload" class="com.test.action.UploadAction">
             <result name="success">/uploadResult.jsp</result>
             <result name="input">/upload.jsp</result>
           <interceptor-ref name="fileUpload">
              <param name="maximumSize">409600</param>
              <param name="allowedTypes">image/jpeg</param>
           </interceptor-ref>
           <interceptor-ref name="defaultStack">
           </interceptor-ref>
          
          </action>感悟:配置文件里少一行语句就出错,错误最难找!
      

  2.   

    呵呵 我遇到过 已经解决  
    其实 主要 就是 加入  spring 框架的问题
    因为 stucts 找不到 spring ioc容器中的 bean 所以你需要配置些 东西
    1.去掉 stuct-config.xml中的  spring  监听配置
    改在 web.xml 中写上
    <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>/WEB-INF/applicationContext.xml</param-value> 
      </context-param>
      <servlet> 
       <servlet-name>context</servlet-name> 
       <servlet-class> org.springframework.web.context.ContextLoaderServlet </servlet-class> 
       <load-on-startup>1</load-on-startup> 
      </servlet>
    你的问题 这样 就应该能够解决了吧  你试试看
      

  3.   

    No result defined for action com.action.ShoppingAction and result input 看错了 原来是这个错啊  没有 配置  input 错误处理页我还以为 你只是  报的  no action的错饿.
    呵呵  看错了
      

  4.   

    谢谢了
    解决了
    是少配置了
    <result name=”input”>/error.jsp </result> 
      

  5.   

    input 错误处理页
    是一定要配置的吗?
      

  6.   

    没有配置
    默认的result的name为“success”
    <result name="input" ></result>
      

  7.   

    一定要配,因为action出错的时候它无法找到对应该跳到的界面