我在操作和消息上收到404:

未找到结果“空”

该动作的映射为:

<action name="startSubmission" class="startSubmissionAction">
    <result type="redirectAction">
        <param name="actionName">uploadFile</param>
    </result>
    <result name="error">/jsp/main/bip/submssionError.jsp</result>
</action>


我尝试了各种组合-更明确-无效,最新版本:

<action name="startSubmission" class="startSubmissionAction" method="execute">
    <result name="success" type="redirectAction">
        <param name="actionName">uploadFile</param>
    </result>
    <result name="error">/jsp/main/bip/submssionError.jsp</result>
</action>


我在操作中添加了一条调试行,它看起来甚至没有被调用-因为没有任何输出。

我在日志上调试增加了:

[DEBUG] 2014-08-11 15:49:55,852 com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler - Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@7a754707], property=struts]
[DEBUG] 2014-08-11 15:49:55,853 com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler - Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@7a754707], property=struts]
[DEBUG] 2014-08-11 15:49:55,853 com.opensymphony.xwork2.DefaultActionProxy - Creating an DefaultActionProxy for namespace [/] and action name [startSubmission]
[DEBUG] 2014-08-11 15:49:55,853 com.opensymphony.xwork2.interceptor.I18nInterceptor - intercept '//startSubmission' {
[DEBUG] 2014-08-11 15:49:55,853 com.opensymphony.xwork2.interceptor.I18nInterceptor - applied invocation context locale=en_GB
[DEBUG] 2014-08-11 15:49:55,853 com.opensymphony.xwork2.interceptor.I18nInterceptor - before Locale=en_GB
[DEBUG] 2014-08-11 15:49:55,854 com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler - Entering nullPropertyValue [target=[rang.ui.actions.submission.StartSubmissionAction@35d2bd5f, com.opensymphony.xwork2.DefaultTextProvider@7a754707], property=struts]
[DEBUG] 2014-08-11 15:49:55,871 org.apache.struts2.interceptor.FileUploadInterceptor - Bypassing //startSubmission
[DEBUG] 2014-08-11 15:49:55,871 com.opensymphony.xwork2.interceptor.StaticParametersInterceptor - Setting static parameters {}
[DEBUG] 2014-08-11 15:49:55,871 com.opensymphony.xwork2.interceptor.ParametersInterceptor - Setting params NONE
[DEBUG] 2014-08-11 15:49:55,871 com.opensymphony.xwork2.interceptor.ParametersInterceptor - Setting params serviceUserNumber => [ 123456 ] submissionType => [ LIVE ]
[DEBUG] 2014-08-11 15:49:55,871 com.opensymphony.xwork2.conversion.impl.XWorkConverter - Retrieving convert for class [class rang.ui.actions.submission.StartSubmissionAction] and property [serviceUserNumber]
[DEBUG] 2014-08-11 15:49:55,995 com.opensymphony.xwork2.conversion.impl.XWorkConverter - Converter is null for property [serviceUserNumber]. Mapping size [0]:
[DEBUG] 2014-08-11 15:49:55,995 com.opensymphony.xwork2.conversion.impl.XWorkConverter - field-level type converter for property [serviceUserNumber] = none found
[DEBUG] 2014-08-11 15:49:55,995 com.opensymphony.xwork2.conversion.impl.XWorkConverter - global-level type converter for property [serviceUserNumber] = none found
[DEBUG] 2014-08-11 15:49:55,995 com.opensymphony.xwork2.conversion.impl.XWorkConverter - falling back to default type converter [com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter@44158e17]
[DEBUG] 2014-08-11 15:49:55,995 com.opensymphony.xwork2.conversion.impl.XWorkConverter - Retrieving convert for class [class rang.ui.actions.submission.StartSubmissionAction] and property [submissionType]
[DEBUG] 2014-08-11 15:49:55,996 com.opensymphony.xwork2.conversion.impl.XWorkConverter - field-level type converter for property [submissionType] = none found
[DEBUG] 2014-08-11 15:49:55,996 com.opensymphony.xwork2.conversion.impl.XWorkConverter - global-level type converter for property [submissionType] = none found
[DEBUG] 2014-08-11 15:49:55,996 com.opensymphony.xwork2.conversion.impl.XWorkConverter - falling back to default type converter [com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter@44158e17]
[DEBUG] 2014-08-11 15:49:55,996 org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor - Validating //startSubmission with method execute.
[DEBUG] 2014-08-11 15:49:56,251 com.opensymphony.xwork2.validator.ValidationInterceptor - Invoking validate() on action rang.ui.actions.submission.StartSubmissionAction@35d2bd5f
[DEBUG] 2014-08-11 15:49:56,251 com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil - cannot find method [validateExecute] in action [rang.ui.actions.submission.StartSubmissionAction@35d2bd5f]
[DEBUG] 2014-08-11 15:49:56,251 com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil - cannot find method [validateDoExecute] in action [rang.ui.actions.submission.StartSubmissionAction@35d2bd5f]
[DEBUG] 2014-08-11 15:49:56,252 com.opensymphony.xwork2.DefaultActionInvocation - Executing action method = null
[DEBUG] 2014-08-11 15:49:56,342 org.apache.struts2.dispatcher.ServletDispatcherResult - Forwarding to location null


行动代码:

     public String execute() throws Exception {

        if (!StringUtils.isNumeric(serviceUserNumber)||serviceUserNumber.length()!=6) {
            super.addActionError("servce user number must be 6 numeric characters only!");
            return ERROR;
        }

        logger.debug("submission object created for SUN: " + this.serviceUserNumber + " submission type: " + this.submissionType);

        return SUCCESS;
    }


春季配置:

<bean id="startSubmissionAction" class="rang.ui.actions.submission.StartSubmissionAction">
</bean>


上传文件操作:

<action name="uploadFile" class="uploadFileAction">
    <result>/jsp/main/bip/uploadFile.jsp</result>
    <result name="error">/jsp/main/bip/submssionError.jsp</result>
</action>


该项目中的其他操作也可以正常工作。该动作是Spring映射的,就可以了。

有任何想法吗?

最佳答案

破解了

操作中将引发异常。

真正的罪魁祸首是我定义了一个异常处理程序,它被打破了。

10-06 05:28