You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by stanlick <st...@gmail.com> on 2008/04/15 20:24:47 UTC

Validation vetoing Action invocation

I am facing an interesting situation and looking for feedback.  I am really
enjoying minimal action configurations such as:

		<action name="wizard_*" class="acme.action.wizard.Wizard" method="{1}">
			<result>/pages/wizard/${nextPage}.jsp</result>
		</action>

where my action class can decide which page to display next.  This works
fine unless a validation fails, which short circuits the action call
altogether.  I discovered the DefaultWorkflowInterceptor was checking for
errors using a call to validationAwareAction.hasErrors() and decided to
override the hasErrors() behavior in my base action class to return false. 
This allows me to determine navigation in my action class independent of the
String return type and multiple result lookup code in the struts.xml
mappings.  All of this and I continue to get appropriate validation
messages.  What seems odd is that I would have to default the hasErrors()
behavior this way.  Is there a switch or flag where I can configure the
framework to execute action always?

I realize the framework navigation logic is "wired" to use the symbolic
names as opposed to names in the action class itself.  However, I feel like
you should be able to use both schemes without weird code in a base class.

Peace,
Scott


-- 
View this message in context: http://www.nabble.com/Validation-vetoing-Action-invocation-tp16703623p16703623.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Validation vetoing Action invocation

Posted by Musachy Barroso <mu...@gmail.com>.
No, the workflow interceptor will check for errors and return 'input'
if there are any:

http://svn.opensymphony.com/fisheye/browse/~raw,r=1630/xwork/trunk/src/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor.java

In your case, why don't you remove the workflow interceptor?

musachy

On Tue, Apr 15, 2008 at 6:24 PM, stanlick <st...@gmail.com> wrote:
>
>  I am facing an interesting situation and looking for feedback.  I am really
>  enjoying minimal action configurations such as:
>
>                 <action name="wizard_*" class="acme.action.wizard.Wizard" method="{1}">
>                         <result>/pages/wizard/${nextPage}.jsp</result>
>                 </action>
>
>  where my action class can decide which page to display next.  This works
>  fine unless a validation fails, which short circuits the action call
>  altogether.  I discovered the DefaultWorkflowInterceptor was checking for
>  errors using a call to validationAwareAction.hasErrors() and decided to
>  override the hasErrors() behavior in my base action class to return false.
>  This allows me to determine navigation in my action class independent of the
>  String return type and multiple result lookup code in the struts.xml
>  mappings.  All of this and I continue to get appropriate validation
>  messages.  What seems odd is that I would have to default the hasErrors()
>  behavior this way.  Is there a switch or flag where I can configure the
>  framework to execute action always?
>
>  I realize the framework navigation logic is "wired" to use the symbolic
>  names as opposed to names in the action class itself.  However, I feel like
>  you should be able to use both schemes without weird code in a base class.
>
>  Peace,
>  Scott
>
>
>  --
>  View this message in context: http://www.nabble.com/Validation-vetoing-Action-invocation-tp16703623p16703623.html
>  Sent from the Struts - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org