DWR and Java Bean Configuration
Jason: DWR dynamically creates a JS file that has a stub that matches the class and methods you’re exposing. so, if you have a Demo class with the method doFoo(), it creates a stub JS class called Demo with the method doFoo() that wraps the Ajax call to the DWR servlet
End of messages received while you were offline at 9:23 AM on Wednesday
Jason: you call Demo.doFoo(<callback>) (iirc) from your page, and it uses the stub plus the plumbing from engine.js to make the XHR call, get the results, and cal your callback function
HobiOne: nice, so question is, if I have 10 beans, I have to create 10 js
Jason: well, you have to configure DWR to expose those beans, then include each JS file in your page
if I were you, i’d use annotations. much easier :)
HobiOne: I see, okay back to your answer, “configure DWR”, do you mean in dwr.xml file
Jason: yes though if you use annotations, I think you set up a different DWR servlet, then just annotate the class and methods you want to expose
it would be nice if DWR offered a KitchenSink.js that included everything else, but I don’t think it does
Sent at 9:27 AM on Wednesday
HobiOne: how about DAO stuff, do I only register beans to dwr.xml or any java classes I make in back end
Jason: well, i’d be REALLY careful what you expose to the outside world
Sent at 9:31 AM on Wednesday
Jason: i.e., i would NOT expose DAOs
HobiOne: got it, only beans, b/c from html, I dont need to talk to DAO, bean should be responsible to communicate with DAOs
A DWR Data Store for Dojo (Putting two powerful AJAX libraries to work for you):
No comments yet.
Leave a comment
-
Archives
- November 2009 (1)
- July 2009 (1)
- June 2009 (5)
- May 2009 (2)
- April 2009 (4)
- March 2009 (2)
- January 2009 (3)
- December 2008 (1)
- November 2008 (2)
- October 2008 (1)
- September 2008 (3)
- August 2008 (2)
-
Categories
-
RSS
Entries RSS
Comments RSS