File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes How to using DWR with Struts? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to using DWR with Struts?" Watch "How to using DWR with Struts?" New topic

How to using DWR with Struts?

Jacket lee

Joined: Oct 30, 2002
Posts: 6
How to using DWR with Struts?

Joined: Jun 23, 2006
Posts: 3
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

Joined: Feb 08, 2006
Posts: 948
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):

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 project uses AjaxAnywhere.

- Brent
Frank Zammetti
Ranch Hand

Joined: Dec 16, 2004
Posts: 136
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.

-- <br />Frank W. Zammetti<br />Founder and Chief Software Architect<br />Omnytex Technologies<br /><a href="" target="_blank" rel="nofollow"></a><br />AIM/Yahoo: fzammetti<br />MSN:<br />Author of "Practical Ajax Projects With Java Technology"<br /> (2006, Apress, ISBN 1-59059-695-1)<br />and "JavaScript, DOM Scripting and Ajax Projects"<br /> (2007, Apress, ISBN 1-59059-816-4)<br />Java Web Parts - <a href="" target="_blank" rel="nofollow"></a><br /> Supplying the wheel, so you don't have to reinvent it!
Billy Tsai
Ranch Hand

Joined: May 23, 2003
Posts: 1304
so does the latest version of DWR supports direct integration with Struts 2 or it requires some tweaking?

BEA 8.1 Certified Administrator, IBM Certified Solution Developer For XML 1.1 and Related Technologies, SCJP, SCWCD, SCBCD, SCDJWS, SCJD, SCEA,
Oracle Certified Master Java EE 5 Enterprise Architect
Frank Zammetti
Ranch Hand

Joined: Dec 16, 2004
Posts: 136
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

Joined: Feb 22, 2008
Posts: 9
I integrated Struts 1.2.7 with DWR 2.0.3 using Spring 2.0.3 dwr tags
I agree. Here's the link:
subject: How to using DWR with Struts?
It's not a secret anymore!