You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Ted Husted (JIRA)" <ji...@apache.org> on 2007/10/29 20:34:40 UTC

[jira] Updated: (WW-2198) Integration of Struts 2 and DWR

     [ https://issues.apache.org/struts/browse/WW-2198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ted Husted updated WW-2198:
---------------------------

            Flags: [Patch]
    Fix Version/s:     (was: Future)
                   2.1.1

> Integration of Struts 2 and DWR
> -------------------------------
>
>                 Key: WW-2198
>                 URL: https://issues.apache.org/struts/browse/WW-2198
>             Project: Struts 2
>          Issue Type: New Feature
>          Components: Integration
>    Affects Versions: 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10
>            Reporter: Nestor Boscan
>            Priority: Minor
>             Fix For: 2.1.1
>
>
> In WebWorks there is a DWR and Struts 2 Integration using the DWRAction class where yo can invoke the Action methods using DWR. I implemented a similar class, but not with all the functionality with Struts 2. I've done a project with this integration and it works really great.
> public class DWRAction
> {
>   private static final Logger log = Logger.getLogger (DWRAction.class);
>     
>   public static Object execute (ActionDefinition actionDefinition, Map params, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws Exception {
>     ActionMapping             mapping;
>     Dispatcher                dispatcher;
>     Map                       context;
>     ActionProxy               proxy;
>     try
>     {
>       dispatcher = Dispatcher.getInstance ();
>       mapping    = new ActionMapping (actionDefinition.getAction(), actionDefinition.getNamespace(), actionDefinition.getMethod(), params);
>       context    = dispatcher.createContextMap (request, response, mapping, servletContext);
>       proxy      = ((ActionProxyFactory) dispatcher.getContainer ().getInstance (ActionProxyFactory.class)).createActionProxy (actionDefinition.getNamespace (), actionDefinition.getAction (), context, false, false);
>       proxy.setMethod (actionDefinition.getMethod ());
>       proxy.execute   ();
>       return (proxy.getAction ());
>     }
>     catch (Exception e)
>     {
>       log.error ("Cannot invoke action '" + actionDefinition.getAction() + "' in namespace '" + actionDefinition.getNamespace() + "'", e);
>       throw e;
>     }
>   }
> }
> In this case I'm invoking the actions method and returning the action to the JSP page so I can access attributes that were set in the invocation. It would be nice to have something like this part of the Struts 2 standard. If you need help implemening this solution I would gladly help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.