No result defined for action com.nynt.action.ManageAction and result input問題

來源:互聯網
上載者:User

No result defined for action com.nynt.action.ManageAction and result input 問題原因:

1)、 在action類中定義的一個return "input";在xml檔案中沒有東西接收。

           舉例說明:

                     struts.xml 檔案:

   <package name="file" namespace="/file" extends="struts-default">
 
      <action name="inputFile" class="action.FileAction" method="inputFile">
        <result name="success">/index.jsp</result>
      </action>

  </package>


action類檔案:

public String inputFile(){
        System.out.println(hh);
        return "input";
    }

此時會報這種異常


2)、struts攔截器無法將前台類型與後台類型匹配報出異常,此時進不了後台

舉例說明:
        jsp頁面:
           <form action="file/inputFile.action" method="post" enctype="multipart/form-data">
            <input type="text" name="hh" value="aa"/>
          <hr/>
          <input type="submit" value="上傳"/>
          </form>

      action類檔案:

              private int hh;

             public String inputFile(){
                  System.out.println(hh);
                 return "success";
            }

        

           action 中 aa 為 int 類型有 setter 和g etter 方法,此時報出此異常

              這是由於struts的攔截器沒有辦法將value裡面的“aa”強制轉化成int類型


     如果jsp頁面有兩個<input type="text" value="bb" name="hh"/>  name值相同
        裡面的類型都是可以強制轉化成 int 的,但是struts的攔截器沒有辦法拼接
        所以也會報出類型不符錯誤,即這個異常。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.