java - How to disable Struts Validation Interceptor? -
i'm trying build javascript / ajax uploader submits form / file upload action. when form submitted, validation interceptor prevents action being run reason, , returns 'input' result. i'm not sure why, i'd stop.
how can disable validation interceptor myaction.execute()
? here's interceptors code struts.xml
:
<interceptors> <interceptor name="appinit" class="com.example.myapp.interceptors.appinit"> </interceptor> <interceptor-stack name="appdefault"> <interceptor-ref name="servletconfig"/> <interceptor-ref name="appinit" /> <interceptor-ref name="defaultstack"> <param name="exception.logenabled">true</param> <param name="exception.loglevel">error</param> <param name="params.excludeparams">dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(request|response)\..*,parameters\...*,submit</param> </interceptor-ref> </interceptor-stack> </interceptors>
here's how go bypassing validation specific action. (i'm assuming wouldn't want disable interceptor entire application.)
<action name="myaction" class="pkg.path.to.myaction"> <interceptor-ref name="appdefault"> <param name="validation.excludemethods">execute</param> <param name="workflow.excludemethods">execute</param> </interceptor-ref> <result>success.jsp</result> </action>
the validation interceptor logs errors. it's workflow interceptor checks if validation errors logged , if yes redirects view mapped input
result code.
edit:
i think nested stacks causing trouble syntax parameter override , i've never tried update: above works. :)<stack-name>.<interceptor-name>.excludemethods
before. may give try though.
but, instead of trying exclude execute()
rename input()
(which on exclude list) , add method="input"
<action>
. kinda makes sense file upload too.
you override validate()
action (though prefer declaratively through struts.xml
)
public class myaction extends actionsupport { ... @override public void validate() { setfielderrors(null); } }
Comments
Post a Comment