[
https://issues.apache.org/struts/browse/WW-2198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42453
]
Nestor Boscan commented on WW-2198:
-----------------------------------
I could make the PlugIn but I'm worried that this code is based on the WebWorks
code. I don't know if there is some legal issue here.
> 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: Future
>
>
> 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.