struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <>
Subject Re: Struts 2 client side validation and preparable interceptor?
Date Fri, 15 Feb 2008 19:44:23 GMT
jpiser wrote:
> I have a couple of questions regarding the preparable interceptor:
> 1. By implementing the preparable interface alone I can have my prepare()
> method called before my action. Great, no problem. 
> But If I want to utilize multiple prepare methods, e.g. prepareInput(),
> prepareCreate(), etc.. that does not work unless I add interceptors to my
> action like this:

Hmm, I haven't done that but I thought the prepare interceptor could do 
this without messing with the interceptor stack. Are you sure you need 
to do this?

> <action name="userMgmt_*" method="{1}" class="pages.userMgmt">
> 	 <interceptor-ref name="params"/>
> 	 <interceptor-ref name="prepare"/>
> 	 <interceptor-ref name="basicStack"/>
>             <result name="input">/pages/userMgmt/createUser.jsp</result>
> 	<result name="create">/pages/userMgmt/createUser.jsp</result>
> 	<result name="profile">/pages/userMgmt/profile.jsp</result>
> </action>
> however, at that point none of my client side validation works anymore in my
> form in the JSP.
> Can anyone explain to me why this is?  Am I missing something?	

Probably basicStack doesn't include some of the interceptors that need 
to be there for client side validation to work. When you specify 
interceptors on an action like that, you override the set of 
interceptors that would otherwise be applied.

Have you tried replacing the interceptor-ref elements with a single 
reference to the paramsPrepareParams stack, or changing the final one to 
reference defaultStack instead of basicStack?


> What I am trying to do is have two JSPs, each with similiar forms that have
> client side validation, that use the same action bean but call different
> action methods and different prepare methods. The reason why I want to use
> the same action bean is that all the parameters are the same and they are
> both ultimately calling an update method that would be the same, so I do not
> need two action beans that would have the same methods.
> Thanks for any help you can give!
> John

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message