• 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

How design controllers for use with AJAX?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

I have tried the simple DOJO decorations available through Spring JS (DatePicker and Textbox). They work well with and without Javascript enabled. But I want more! I want 'bread crumb trails', advanced datagrids, dynamic diagrams and such. Does Spring JS expand to more than just client-side validation? I haven't found any good documentation yet.

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?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Daniel Näslund
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In short: no; it'd depend on the widget, the framework, application requirements, etc.
 
Ever since I found this suit I've felt strange new needs. And a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic