Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to using DWR with Struts?

 
Jacket lee
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to using DWR with Struts?
 
Manish
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DWR and Struts are not directly related.
Struts will return the view page. Once you have the view page, you can call the java script which inturn calls dwr servlet.
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are interesting in finding out more about using DWR with a Struts 1.x application, there have been various threads over on the Struts forum. Here is one that is a little old but has some good info (especially the posts by Merrill Higginson):

http://www.coderanch.com/t/53656/Struts/Ajax-struts-integration

DWR seems to be one of the best frameworks for adding in Ajax behavior with Struts 1.x. I have only played with DWR a little...my project uses AjaxAnywhere.

- Brent
 
Frank Zammetti
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're talking about Struts 1, then you can of course have DWR in the mix, but it's a little bit ackward. I have an application that was built that way in production, and what it basically comes down to is you let Struts handle the overall page flow, which tends to not happen nearly as much in any AJAX application anyway, and then DWR kind of handles events for a given page. That works reasonably well, but it's not ideal either because you could do it all with DWR and have simpler code.

If you're talking Struts 2, things *can* be a little different because Actions in S2 are often times POJOs, which DWR can actually instantiate and call methods on. I've never personally done this other than some playing around, but it seems like there would be some limitations involved (i.e., any knowledge of S2 from the Action may not work, HTTP* objects woul dhave to be accounted for, etc), but in theory it should work alright.
 
Billy Tsai
Ranch Hand
Posts: 1304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so does the latest version of DWR supports direct integration with Struts 2 or it requires some tweaking?
 
Frank Zammetti
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It requires some tweaking, that's my understanding. That'd be a good question to toss up on the DWR mailing list, see where that support really stands today.
 
Deha Peker
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I integrated Struts 1.2.7 with DWR 2.0.3 using Spring 2.0.3 dwr tags
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic