• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DWR and HTML snippets

 
Rusty Enisin
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am about to drop the idea of using DWR. But before I did I wanted to ask.

I would like my Java class to return a dynamically generated HTML snippet, not just data. DWR seems to return back data only. I want HTML structured data. Of course I could do this, but there is no JSP with DWR. I would have to hand code string concatenations right in the Java class. Am I just stuck in my MVC pattern world?

An alternative to returning the HTML snippet would be to hide all the HTML snippets in the requesting page, request data from the server, and then merge the two on the front end. I did not want to do this because it required the user to load the HTML snippets when they might not use them. And the JavaScript to process it this way would be much bigger. And the data I am returning is equivalent to a bean that also contains a collection of beans. Creating the output would look similar to writing Servlets without JSP (i.e. tons of string concatenations). That leaves me back at square one.

At this point it seems like it is better to go with directly using the XMLHttpRequest object myself. Then I can use Struts/Servlets and JSPs to create snippets or otherwise structured data as I wish.

Maybe DWR is not the answer? Am I missing something?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The whole point of DWR is to approximate an RPC mechansim to call Java methods using Ajax as a transport mechanism. If you are planning to return HTML snippets generated via JSP, DWR is massive overkill.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic