Discussions

Web tier: servlets, JSP, Web frameworks: Servlet Design

  1. Servlet Design (3 messages)

    Hello there,

    What would be a good design to choose for developing a simple web application based on Servlets without using any of the available frameworks (struts, jsf, etc)?

    By *simple* I mean there are no extensive validation for example, althougt some basic navigation rules do apply.

    Thanks in advance
  2. Why even use Java if you're not going to use a framework or MVC? Consider Php, Groovy, Ruby. I assume you are not going to use a framework because you don't have time to learn on right? There for use a language to help you get the hack done quickly. Now if you don't know any other "quicky" language than maybe you need to make the time to either learn one or (preferred) use a framework. If you choose the right one than it really isn't that hard to learn

    Kris Thompson
    www.frameworks-boulder.org
  3. Simple MVC[ Go to top ]

    For small simple web applications with several dynamic pages, it is unnecessary to use framwork. You can take advantage of the Requestdispatcher.
    One servlet acts as controller and "forward" request to particular jsp page according to the attributes of the request. JSP acts as View.
    This is a very simple MVC model.

    However, if your application will bloat in the future, you'd better use framework as early as possible.
  4. Hi,

    for a simple application splitting the functionality between many components or using a complex framework is overkill. You can stay close to the MVC model and use separate JSP pages for the UI and nonvisual parts. Each application operation would (such as viewList, viewDetail, validateUser, purchase, etc) map to a separate JSP.

    The application is easier to maintain and the business logic implementation can be replaced with a Controller servlet and/or Action classes (like in the J2EE Blueprints or Struts at a later date).