-1
發生默認動作這是我的代碼當我寫在我的struts.xml中的錯誤是支柱
struts.xml的
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"http://struts.apache.org/dtds/struts-2.1.dtd">
<!-- ********************************************************** -->
<struts>
<!-- ********************************************************** -->
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<!-- ********************************************************** -->
<package name="default" extends="struts-default">
<!-- *****************DEFAULT ACTION STARTS********************* -->
<default-action-ref name="somedefault" />
<!-- ******************************* -->
<action name="somedefault">
<result>/jsp/DefaultPage.jsp</result>
</action>
<!-- *****************DEFAULT ACTION ENDS********************* -->
<!-- *****************GLOBAL RESULTS STARTS********************* -->
<global-results>
<result name="null">/jsp/Fail1.jsp</result>
<result name="excep">/jsp/Fail2.jsp</result>
</global-results>
<!-- ******************GLOBAL RESULTS ENDS********************** -->
<!-- *************GLOBAL EXCEPTION MAPPING STARTS*************** -->
<global-exception-mappings>
<exception-mapping result="null" exception="java.lang.NullPointerException" />
<exception-mapping result="excep" exception="java.lang.Exception" />
</global-exception-mappings>
<!-- **************GLOBAL EXCEPTION MAPPING ENDS***************** -->
<!-- ******************OTHER ACTION STARTS*********************** -->
<action name="Calculator" class="com.action.Calculator">
<exception-mapping result="error" exception="java.lang.NumberFormatException" />
<exception-mapping result="none" exception="java.lang.NullPointerException" />
<result name="success">/jsp/Success.jsp</result>
<result name="error">/jsp/Error.jsp</result>
<result name="none">/jsp/Error1.jsp</result>
</action>
<!-- ************************************ -->
<action name="Action1" class="com.action.Action1">
<result name="success">/jsp/Success1.jsp</result>
</action>
<!-- ************************************ -->
<action name="Action2" class="com.action.Action2">
<result name="success">/jsp/Success1.jsp</result>
</action>
<!-- *********************OTHER ACTION ENDS********************** -->
</package>
<!-- ************************************************************ -->
</struts>
我不知道發生了whts錯誤 錯誤顯示 元素類型「包」的內容必須匹配「(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global- 異常映射?,行動*)」。 請糾正我的問題
Dup:http://stackoverflow.com/q/3742379/1700321。 –
我遵循那個順序先生你檢查它 –
不,你不.. –