[
https://issues.apache.org/struts/browse/WW-2198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42722
]
Tom Schneider commented on WW-2198:
-----------------------------------
Sorry, I thought I commented on this. Following Don's comments, I think this
would be better implemented as an external plugin. Most of the integration
that we have has been implemented this way, so I'm not sure we would want to
move this into the core codebase right away.
> 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
> Assignee: Tom Schneider
> 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.