1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    35
    Vote Rating
    0
    abhinavchugh is on a distinguished road

      0  

    Default Ext js integration with DWR

    Ext js integration with DWR


    Hi

    Is it possible to integrate the ext js with DWR(Direct web remoting)? Please tell me the approach how I can do this integration.

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    I did it back in Ext JS 2.x. I absolutely hated it. DWR is horrible and I would highly suggest looking at the Sencha Direct stack instead.

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    12
    Vote Rating
    0
    MonkeeOfEvil is on a distinguished road

      0  

    Default


    I'm having pretty good success with using DWR3 configured to deliver JSON inside of Apache OFBIZ & EXT 4. It's really straight forward and easy to use.

    In your web.xml file, you should have something similar to this:

    PHP Code:
    <servlet>      <servlet-name>dwr-invoker</servlet-name>      <display-name>DWR Servlet</display-name>      <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>      <init-param>         <param-name>debug</param-name>         <param-value>true</param-value>      </init-param>      <init-param>             <param-name>jsonpEnabled</param-name>             <param-value>true</param-value>          </init-param>      </servlet
    The key being
    PHP Code:
          <init-param>             <param-name>jsonpEnabled</param-name>             <param-value>true</param-value>          </init-param
    Then you just do things the normal EXT way. Of course you still need to go through the usual steps of setting up a DWR application and creating your dwr.xml, DwrHelper.java ( or w/e you end up calling it), etc.

    Then you just access the functions as normal ( as configured in dwr.xml ): myapp.com/dwr/SomeClass/memberFunc/param1/param2/param3, etc
    or
    myapp.com/dwr/SomeClass/memberFunc?args=etc

    One compromise I had to make was using HttpServletRequest request, HttpServletResponse response as my parameters in any exposed functions. Otherwise you can run in to problems where you're trying to get data from a form and then dynamically build a URL to call your function..ugh.... it ends up making your code ugly and much, much larger than it needs to be... so save yourself the trouble unless you know for sure it won't be a headaches to go the "normal" "restful" route.

    There are a few other gotchya's / caveats that I ran in to when I first started using DWR3+EXT... but i don't have time to list them all right now. Will revisit this thread a bit later and post them.

    I don't recommend trying using DWR2 w/ the DwrProxy for EXT. It chugs donkey dick and doesn't work on 4.x. If you have the option of not using DWR, or ditching it, then I would look in to EXT Direct.