Hobione's Weblog

Living & Breathing in Web 2.0 Era

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):

December 14, 2007 - Posted by | Ajax Libraries, DWR

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: