• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MVC design pattern in the Client Server Architecture?

 
kri shan
Ranch Hand
Posts: 1478
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can i implement MVC design pattern in the Client Server Architecture? Whether MVC supports only n-tire architecure?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You really could model MVC inside each layer. Any given layer's API could be a view. Or you could picture a larger, more abstract MVC for the whole structure.

Describe your client & server a bit ... browser and web server or Swing Client and EJB server or some other variation? There is probably some flavor of MVC that can be used in just about any variation.
 
kri shan
Ranch Hand
Posts: 1478
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My client is browser based, web server is Apache/Tomcat, server components are java based..
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's common to do a flavor of MVC for web apps like that. In general servlets act as controllers, JSPs act as view and some kind of "plain old java objects" act as the model.

In one variation, you build a servlet/controller per web page. It interprets the entry fields and buttons (user gestures) for one web page. Other variations use a single servlet for the whole application. It maps a URL parameter or a combination of hidden fields to java classes that do controller behaviors.

The controller asks POJOs to do some work and then pass the results on to a JSP as a request object parameter. The JSP pulls data off the request and builds the next page.

Struts is one example of a framework that does all this. I made my own at work with a single servlet and a set of Commmand pattern objects. This stuff can be as simple or as complex as you like.

Hope that helps!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic