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?