java - Best way for using JSP and Servlets in an MVC webapp -


i'm working on dynamic website in java , i'm interested in sticking mvc pattern. best way divide work of webapp between jsp , servlets?

should see jsp file view of program , servlet more controller?

if should use servlet controller, wise give servlet more 1 functionallity, example: send in action number servlet , servlet switch case on decide action do. way can create few servlets , each 1 in charge of separate type of requests.

should see jsp file view of program , servlet more controller?

yes. jsps best used implementing views.

depending on application requirements, there may other views not implemented jsps. proposed division of responsibility starting point.

if should use servlet controller, wise give servlet more 1 functionallity, example: send in action number servlet , servlet switch case on decide action do.

this more debatable. can either have small number of servlets , switch inside servlet or have large number of servlets , switch in "web.xml" file or in framework classes. instance, lot of people use restlet framework, , / or annotations manage dispatching of requests controller servlets.


my general advice be:

  • don't try code yet framework. there lots of them out there, , @ least 1 of them should enough.
  • don't over-design.

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -