I've just recently explored DWR for the first time, and I was quite
impressed. However, my take was that of the authors of the page you
cited -- there's really not much rationale that I can see for doing
anything specifically with Struts and DWR together.
Good practice for a Struts application would be for your Struts
action classes to contain a minimum of business logic, and to
primarily concern themselves with converting strings, the only kind
of request parameters which can be submitted by HTTP, into whatever
form is appropriate to your Struts-agnostic application layer.
If you have this kind of organization, than DWR fits at the same
layer as Struts, and given that it has full access to the
Servlet-level execution context, it shouldn't need anything specific
from Struts; your remoted object would do the same thing an action
does, passing values into your business layer.
The ability for DWR to remote beans defined with Spring makes this
even easier, because you can make it very easy for the remoted object
to reference these application-layer service beans. (You could
always look them up in a ServletContext or something, but the Spring
bean lookup is much more elegant.)
The one concession to Struts that I made with my implementation (an
"add to cart" feature) was to subclass the DWR ExecutionContext
object to expose a Struts ActionContext object (actually, my own
subclass of ActionContext) - this can easily be made any time a
request, response, and servlet context are available, and it allows
me to maintain a consistent guard against access to session and
request scoped objects, rather than having to spread a bunch of
references to String constant attribute names through out my code.
As far as I can tell, DWR and Struts will co-exist peacefully
together, but without much concern for each other. Is there a
specific way in which you need DWR to use an ActionForm? If there
is, that may be a sign of a place where you should re-organize the
responsibilities of various classes in your application.
Joe
At 5:39 PM -0700 9/16/05, Greg Pelly wrote:
I am thinking about migrating an application using Struts and
ActionForms to use the DWR implementation of AJAX. I stood up a simple
DWR sample and I'm realizing that it may not be possible to integrate
DWR with ActionForms -- DWR makes requests through the "backdoor" (ie,
XMLHttpRequest), rather than by submitting a form created by
<html:form>, so the Struts ActionForm does not get populated. In fact,
request.getParameterNames() returns an 0-element enumeration, which
makes me think it may not be possible at all.
Does anyone have experience with ActionForms and AJAX? I did a quick
Google search and found this article:
http://getahead.ltd.uk/dwr/server/struts
Any help would be appreciated.
Greg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Joe Germuska
[EMAIL PROTECTED]
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction" -The Ex
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]