views:

440

answers:

2

Every tutorial I have found on Struts2 Declarative validation explains how to make the fields validated which is nice and easy. But how do you enter the page with out it being validated?

I have the below Action mapped

    <package name="admin" namespace="/admin" extends="struts-default">
    <action name="display_*" class="action.admin.AdminAction" method="display">
     <result name="input">/WEB-INF/pages/secure/admin/adminUsers.jsp</result>
     <result name="success">/WEB-INF/pages/secure/admin/adminUsers.jsp</result>
    </action>

Shouldn't I be able to call it with admin/display_input.action to skip validation?

A: 

Maybe this will help?

http://www.mail-archive.com/[email protected]/msg69320.html

Try setting the method attribute to method="{1}".

Nate
+1  A: 

You are using defaultStack (it's activated by default), see http://struts.apache.org/2.0.11/docs/interceptors.html (<default-interceptor-ref name="defaultStack"/>)

It contains validation interceptor which will ignore validation only on methods input,back,cancel,browse. So you can actoin via one of these methods, or you can use interceptor stack without validation interceptor (basicStack , for example).

You also can annotate your action method with @SkipValidation annotation.

Nikita Prokopov