This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I want to write a web 2.0 app, get wealthy and live happily ever after. What stands in my way is some understanding of how to design the Spring controllers for use with my AJAX framework.
Perhaps Spring JS is not the right design choise either. I want to have clear separation between the different layers of the app and Spring JS is a glue that makes the view layer dependent of Spring. So I was thinking: I use DOJO and send XML or JSON to my controllers using the RESTful approach that is supported through Spring 3.0. But then I need some controllers that return XML or JSON and some that return views, i.e. JSP-pages. This can get a bit messy. I was thinking of using one package for controllers returning JSP pages and one for controllers returning XML or JSON. Is that the way to do it?
That's *one* way to do it--is it the "right" way? Depends. I tend to cluster classes by application functionality, which is independent of the view technology.
Joined: Jul 14, 2009
David Newton wrote:That's *one* way to do it--is it the "right" way? Depends. I tend to cluster classes by application functionality, which is independent of the view technology.
Thanks for your answer. I can see the advantages in keeping everything associated with one application functionality together.
Another question, but still on the topic. I saw that you were proficient in Struts so maybe this can be generalized to any MVC framework: When using AJAX calls, how do you give feedback for illegal input, that is form:error and such? If it's a simple textbox it's easy but what about input in an complex datagrid for instance? Do you write your own tags for it or use the ones provided by the framework? Perhaps setting my own error attributes is an option, that is, not using the MVC framework for error handling at all. But it seems as a waste of time to reimplement something that already exists.
In short: Is there some general solution to the problem of validating complex AJAX widgets?