• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DWR and HTML snippets

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic