• 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

[AJAX] Web Application logical division

 
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is suggested to divide the application according to MVC architecture. and that is how I have divided my application too.

Controller handles the user request , then it calls the service layer (the layer where you code the business logic) and in turn service layer communicates to model for DB related stuff and it returns back to controller and renders the view.

I want to know how do you guys handle this when it's a AJAX request. I am using DWR AJAX framework.

Javascript calls to Service Layer directly OR you create a Java class that is equivalent to controller? so that the flow become , JavaScript <-> Controller (different class then the other controller) <-> Service class <-> Model

It is important for me to decide while finalizing the architecture before I jump into coding.
 
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
Why should an Ajax request be handled any differently from a "normal" request? Just because it's an Ajax request isn't an excuse to throw good design out the window.
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At some point I thought to call directly to service layer from Javascript . but now I will also create a separate Controller to handle AJAX requests.

Thank you Bear.
 
reply
    Bookmark Topic Watch Topic
  • New Topic