JavaScud | Forum | JIRA | Blog |
  Dashboard > DWR中文文档 > ... > Integration > Struts Integration
  DWR中文文档 Log In View a printable version of the current page.  
  Struts Integration
Added by 黑灵, last edited by 黑灵 on Oct 18, 2006
Labels: 
(None)

整合Struts

DWR几乎可以和任何Framework一起工作。这个网站(DWR的官方网站)就是这一点的有力证明,因为它是在Drupal(PHP)中使用DWR。

DWR和Struts整合有两个层次。最基础的层次就是同时使用两个Framework,这是非常容易的,但是这样就不允许在DWR和Struts之间共享Action了。

DWR可以调用任何方法,所以没有理由不让你从DWR调用Struts的Action,除非你不想这样用。ActionForm的内容是什么,当返回ActionForward时DWR怎么做?

一个比较好方法是重构你想调用的Action,提取出Action的逻辑。DWR和你的Action就可以同时调用相同的方法了。

The 'struts' 创造器

DWR1.1增加了一个StrutsCreator。你可以哉dwr.xml中这样使用:

<allow>
  ...
  <create creator="struts" javascript="ScriptName">
    <param name="formBean" value="formBeanName"/>
  </create>
  ...
</allow>

这样就允许你在DWR中调用FormBean了。

开始顺序

如果你要使用StrutsCreator那么你保证Struts在DWR之前被初始化。你可以在web.xml中把Struts的<load-on-startup>设置的比DWR低。

对于form的支持没有它说得那么好

Posted by Anonymous at Nov 24, 2006 15:25 | Reply To This

啥集成,配了老半天,也没用,怎么调Action类,也没写????

Posted by Anonymous at Jul 26, 2007 14:51 | Reply To This

这样介绍得不清楚,dwr调用formbean有何意义?我们要用的是Action里面的方法,怎么用也不清楚。

Posted by Anonymous at Aug 24, 2007 09:58 | Reply To This

看StrutsCreator的代码就知道,dwr设计的就是只能调用formbean的方法,formbean就如一个普通javabean似的,不知有什么方法值得去调用,dwr实现的东西还是比较多了,首先他要让Action能够把相应的参数组装到相应formbean中,以现在dwr的传参方式有点困难。

Posted by Anonymous at Sep 13, 2007 14:16 | Reply To This

DWR调用formbean的方法,我觉得最大意义是可以设置form中比较复杂的对象的值。
比如说对一个对象列表进行增加或删除。

Posted by Anonymous at Oct 10, 2007 22:31 | Reply To This

我可以理解做,我在前台直接调用formbean理的方法,dwr已经为我做号了,以前struts做的东西,为form填充formbean,但是dwr如何处理mapping,我在action理做跳转怎么处理的呢?

Posted by Anonymous at Feb 20, 2008 20:51 | Reply To This

还是有他的不足呀

不过已经不错了

呢用就用把

Posted by Anonymous at Apr 10, 2008 17:21 | Reply To This

xcvxvxvcvxcvxcv

Posted by Anonymous at May 20, 2008 11:35 | Reply To This
Site running on a free Atlassian Confluence Open Source Project License granted to WebWork China. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.3 Build:#808 May 29, 2007) - Bug/feature request - Contact Administrators