seems to be a disconnect between xwork and struts the 3rd parameter is a map extraContext - a Map of extra parameters to be provided to the ActionProxy xwork is the higher authority since it is a base library..here is the doc from xwork 1.2.3
createActionProxyhttp://www.opensymphony.com/xwork/api/com/opensymphony/xwork2/ActionProxyFactory.html public abstract ActionProxy createActionProxy(String namespace, String actionName, Map extraContext, boolean executeResult, boolean cleanupContext) throws Exception Creates an ActionProxy for the given namespace and action name by looking up the configuration. The ActionProxy should be fully initialized when it is returned, including having an ActionInvocation instance associated. Parameters:namespace - the namespace of the actionactionName - extraContext - a Map of extra parameters to be provided to the ActionProxyexecuteResult - flag which tells whether the result should be executed after the actioncleanupContext - Returns:ActionProxy Throws: Exception apparently Struts Doc is out of synch with xwork doc huihoo gets it right ActionProxy createActionProxy(String namespace, String actionName, Map extraContext, boolean executeResult, boolean cleanupContext) Creates an ActionProxy for the given namespace and action name by looking up the configuration. and yes please file a JIRA in Struts Documentation Thanks Martin Gainty ______________________________________________ Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Fri, 15 May 2009 07:29:24 +0530 > Subject: Re: DWRValidator not working in Struts 2.1.6 > From: strutstwou...@gmail.com > To: user@struts.apache.org > > Martin, > > I tried with : > > ActionProxy proxy = actionProxyFactory.createActionProxy(namespace, > mapping.getName(), "execute", ctx); > > Somehow the method name is coming in as null, so i hardcoded it to execute > for now ; need to see why. > > This seems to work fine, i'm getting the errors as an alert box on the page, > but that's a different story. > > Should i open a JIRA for this ? > > Thanks, > Joseph > > > > > On Fri, May 15, 2009 at 6:41 AM, j alex <strutstwou...@gmail.com> wrote: > > > Hi Martin, > > > > I had seen the configs in the struts-showcase, and used all of them as-is ; > > just added a javascript fn. to invoke DWR and was getting the NPE. So, looks > > like there's something broken in the default distro. I'll try your > > suggestion of using : > > > > * > > > > public > > * ActionProxy createActionProxy(String namespace, String actionName, > > String methodName, Map<String, Object> extraContext, *boolean*executeResult, > > *boolean* cleanupContext); > > instead of : > > > > *public* ActionProxy createActionProxy(ActionInvocation actionInvocation, > > String namespace, String actionName, String > > methodName,*boolean*executeResult, > > *boolean* cleanupContext); > > > > Hope this is what you meant? > > > > Thanks, > > Joseph > > > > > > > > > > > > > > On Fri, May 15, 2009 at 3:40 AM, Martin Gainty <mgai...@hotmail.com>wrote: > > > >> > >> the DWR configuration you will need is located at > >> struts-showcase\WEB-INF\dwr.xml > >> > >> <?xml version="1.0" encoding="UTF-8"?> > >> <!-- START SNIPPET: dwr --> > >> <!DOCTYPE dwr PUBLIC > >> "-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN" > >> "http://www.getahead.ltd.uk/dwr/dwr10.dtd"> > >> <dwr> > >> <allow> > >> <create creator="new" javascript="validator"> > >> <param name="class" > >> value="org.apache.struts2.validators.DWRValidator"/> > >> </create> > >> <convert converter="bean" > >> match="com.opensymphony.xwork2.ValidationAwareSupport"/> > >> </allow> > >> <signatures> > >> <![CDATA[ > >> import java.util.Map; > >> import org.apache.struts2.validators.DWRValidator; > >> > >> DWRValidator.doPost(String, String, Map<String, String>); > >> ]]> > >> </signatures> > >> </dwr> > >> <!-- END SNIPPET: dwr --> > >> > >> where the servlet would be defined in WEB-INF/web.xml configuration > >> <servlet> > >> <servlet-name>dwr</servlet-name> > >> <servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class> > >> <init-param> > >> <param-name>debug</param-name> > >> <param-value>true</param-value> > >> </init-param> > >> </servlet> > >> <servlet-mapping> > >> <servlet-name>dwr</servlet-name> > >> <url-pattern>/dwr/*</url-pattern> > >> </servlet-mapping> > >> > >> the config files struts.xml or struts-default.xml would contain the bean > >> definitions for OgnlValueStackFactory e.g. > >> > >> <bean type="com.opensymphony.xwork2.util.ValueStackFactory" name="struts" > >> class="com.opensymphony.xwork2.ognl.OgnlValueStackFactory" /> > >> > >> <bean type="com.opensymphony.xwork2.ActionProxyFactory" name="xwork" > >> class="com.opensymphony.xwork2.DefaultActionProxyFactory"/> > >> > >> your webapp's > >> execution flow is governed by interceptors you insert into (defaultStack) > >> interceptor stack declaration as seen here > >> <interceptor-stack name="defaultStack"> > >> <interceptor-ref name="exception"/> > >> <interceptor-ref name="alias"/> > >> <interceptor-ref name="servletConfig"/> > >> <interceptor-ref name="i18n"/> > >> <interceptor-ref name="prepare"/> > >> <interceptor-ref name="chain"/> > >> <interceptor-ref name="debugging"/> > >> <interceptor-ref name="profiling"/> > >> <interceptor-ref name="scopedModelDriven"/> > >> <interceptor-ref name="modelDriven"/> > >> <interceptor-ref name="fileUpload"/> > >> <interceptor-ref name="checkbox"/> > >> <interceptor-ref name="staticParams"/> > >> <interceptor-ref name="actionMappingParams"/> > >> <interceptor-ref name="params"> > >> <param name="excludeParams">dojo\..*,^struts\..*</param> > >> </interceptor-ref> > >> <interceptor-ref name="conversionError"/> > >> <interceptor-ref name="validation"> > >> <param > >> name="excludeMethods">input,back,cancel,browse</param> > >> </interceptor-ref> > >> <interceptor-ref name="workflow"> > >> <param > >> name="excludeMethods">input,back,cancel,browse</param> > >> </interceptor-ref> > >> </interceptor-stack> > >> > >> The ActionProxyFactory is used to create ActionProxies to be executed. It > >> is the entry point to XWork that is used > >> by a dispatcher to create an ActionProxy to execute for a particular > >> namespace and action name. > >> > >> where xwork 1.2.3 specifies createActionProxy with 5 parameters > >> createActionProxy(String namespace, > >> String actionName, > >> Map extraContext, > >> boolean executeResult, > >> boolean cleanupContext) > >> > >> > >> Creates an ActionProxy for the given namespace and action name by looking > >> up the configuration. > >> > >> instead of > >> ActionProxy proxy = actionProxyFactory.createActionProxy(inv, namespace, > >> > mapping.getName(), mapping.getMethod(), *true*, *true*); > >> > >> switch the 1st arg of inv (assuming that contains action) and 2nd arg of > >> namespace(assuming that contains namespace) and drop getMethod() unless of > >> course that has the desired extraContext > >> then proxy.execute() > >> will set the ActionContext from the ActionInvocation into the desired > >> ActionContext > >> > >> documentation available at > >> > >> http://struts.apache.org/2.1.6/struts2-core/apidocs/com/opensymphony/xwork2/ActionProxy.html > >> > >> hope that answers your question > >> Martin > >> ______________________________________________ > >> Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung/Note > >> de déni et de confidentialité > >> This message is confidential. If you should not be the intended receiver, > >> then we ask politely to report. Each unauthorized forwarding or > >> manufacturing of a copy is inadmissible. This message serves only for the > >> exchange of information and has no legal binding effect. Due to the easy > >> manipulation of emails we cannot take responsibility over the the contents. > >> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene > >> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte > >> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht > >> dient lediglich dem Austausch von Informationen und entfaltet keine > >> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von > >> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > >> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le > >> destinataire prévu, nous te demandons avec bonté que pour satisfaire > >> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie > >> de ceci est interdite. Ce message sert à l'information seulement et n'aura > >> pas n'importe quel effet légalement obligatoire. Étant donné que les email > >> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter > >> aucune responsabilité pour le contenu fourni. > >> > >> > >> > >> > >> > Date: Fri, 15 May 2009 01:50:27 +0530 > >> > Subject: Re: DWRValidator not working in Struts 2.1.6 > >> > From: strutstwou...@gmail.com > >> > To: user@struts.apache.org > >> > > >> > martin, > >> > > >> > i had seen the StrutsPrepareFilter API and as it says "Prepares the > >> request > >> > for execution by a later StrutsExecuteFilter filter instance. " . I've > >> both > >> > the StrutsPrepare and Execute filters configured plus the DWR servlet. > >> > > >> > You were mentioning a working example of DWRValidator in the showcase, > >> but i > >> > couldn't find it. > >> > > >> > My understanding is that when a DWR request is sent - it goes thru > >> > StrutsPrepareFilter , StrutsExecuteFilter (which executes the Action > >> > preceded by interceptor stack) , finally DWRServlet. So, by the time the > >> > request reaches DWRServlet, it would have done the validations and the > >> > errors would be populated. > >> > > >> > The point i'm confused is that in DWRValidator doPost method, there's > >> again > >> > a call to execute the Action like : > >> > > >> > ActionProxy proxy = actionProxyFactory.createActionProxy(inv, namespace, > >> > mapping.getName(), mapping.getMethod(), *true*, *true*); > >> > proxy.execute(); > >> > and this fails for some reason since valuestackfactory is null. > >> > > >> > Thanks, > >> > Joseph > >> > > >> > On Fri, May 15, 2009 at 1:22 AM, Martin Gainty <mgai...@hotmail.com> > >> wrote: > >> > > >> > > > >> > > StrutsPrepareFilter documentation is available at > >> > > > >> > > > >> http://struts.apache.org/2.1.6/struts2-core/apidocs/org/apache/struts2/dispatcher/ng/filter/StrutsPrepareFilter.html > >> > > > >> > > there is a brand new feature that musachy put in svn on monday to > >> > > specifically work-around action execute > >> > > i would ping him to see if this made was built into latest distro > >> > > > >> > > Thanks, > >> > > Martin Gainty > >> > > ______________________________________________ > >> > > Disclaimer and Confidentiality/Verzicht und > >> Vertraulichkeitanmerkung/Note > >> > > de déni et de confidentialité > >> > > This message is confidential. If you should not be the intended > >> receiver, > >> > > then we ask politely to report. Each unauthorized forwarding or > >> > > manufacturing of a copy is inadmissible. This message serves only for > >> the > >> > > exchange of information and has no legal binding effect. Due to the > >> easy > >> > > manipulation of emails we cannot take responsibility over the the > >> contents. > >> > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene > >> > > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede > >> unbefugte > >> > > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese > >> Nachricht > >> > > dient lediglich dem Austausch von Informationen und entfaltet keine > >> > > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit > >> von > >> > > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > >> > > Ce message est confidentiel et peut être privilégié. Si vous n'êtes > >> pas le > >> > > destinataire prévu, nous te demandons avec bonté que pour satisfaire > >> > > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la > >> copie > >> > > de ceci est interdite. Ce message sert à l'information seulement et > >> n'aura > >> > > pas n'importe quel effet légalement obligatoire. Étant donné que les > >> email > >> > > peuvent facilement être sujets à la manipulation, nous ne pouvons > >> accepter > >> > > aucune responsabilité pour le contenu fourni. > >> > > > >> > > > >> > > > >> > > > >> > > > Date: Thu, 14 May 2009 23:55:34 +0530 > >> > > > Subject: Re: DWRValidator not working in Struts 2.1.6 > >> > > > From: strutstwou...@gmail.com > >> > > > To: mgai...@hotmail.com; user@struts.apache.org > >> > > > > >> > > > Just wanted to make sure my email reached the full users' list. I > >> > > > still havent been able to make any progress on this. Has anyone got > >> > > > the DWRValidator working in Struts 2.1? > >> > > > > >> > > > On 4/24/09, j alex <strutstwou...@gmail.com> wrote: > >> > > > > Martin, > >> > > > > > >> > > > > I want DWRServlet to handle only the Action validations, not > >> Action > >> > > > > execution. I'm invoking the validator.doPost() when user tabs off > >> a > >> > > field > >> > > > > in > >> > > > > order to validate the entered data. > >> > > > > > >> > > > > I couldn't find the example you are referring to in > >> > > > > http://struts.apache.org/2.1.6/docs/tutorials.html . Could you > >> please > >> > > tell > >> > > > > me a specific link ? > >> > > > > > >> > > > > Thanks > >> > > > > s2user > >> > > > > > >> > > > > > >> > > > > > >> > > > > On Fri, Apr 24, 2009 at 7:50 PM, Martin Gainty < > >> mgai...@hotmail.com> > >> > > wrote: > >> > > > > > >> > > > >> who handles the action execution DWRServlet or > >> > > > >> StrutsPrepareAndExecuteFilter? > >> > > > >> > >> > > > >> If you want to use DWRServlet to handle action execution you are > >> > > better > >> > > > >> off > >> > > > >> just using StrutsPrepareFilter to prepare the request as in this > >> > > example > >> > > > >> > >> > > > >> > >> > > > >> > >> > > > >> http://struts.apache.org/2.1.6/struts2-core/apidocs/org/apache/struts2/dispatcher/ng/filter/StrutsPrepareFilter.html > >> > > > >> > >> > > > >> web.xml entry > >> > > > >> <filter> > >> > > > >> <filter-name>struts-prepare</filter-name> > >> > > > >> > >> > > > >> > >> > > > >> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class> > >> > > > >> <init-param> > >> > > > >> <param-name>actionPackages</param-name> > >> > > > >> > >> > > <param-value>org.apache.struts2.showcase.person</param-value> > >> > > > >> </init-param> > >> > > > >> </filter> > >> > > > >> > >> > > > >> There is a very good example of StrutsPrepareFilter functionality > >> > > working > >> > > > >> in combination with DWRServlet in struts2-showcase tutorial > >> located at > >> > > > >> > >> > > > >> > >> > > > >> > >> > > > > > >> > > > > >> > > > > >> --------------------------------------------------------------------- > >> > > > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > >> > > > For additional commands, e-mail: user-h...@struts.apache.org > >> > > > > >> > > > >> > > _________________________________________________________________ > >> > > Hotmail® has a new way to see what's up with your friends. > >> > > > >> > > > >> http://windowslive.com/Tutorial/Hotmail/WhatsNew?ocid=TXT_TAGLM_WL_HM_Tutorial_WhatsNew1_052009 > >> > > > >> > >> _________________________________________________________________ > >> Insert movie times and more without leaving Hotmail®. > >> > >> http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009 > >> > > > > _________________________________________________________________ Insert movie times and more without leaving Hotmail®. http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009