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的攔截器沒有辦法拼接
所以也會報出類型不符錯誤,即這個異常。