Page-centric or Servlet-centric or Frameworks

Discussions

Web tier: servlets, JSP, Web frameworks: Page-centric or Servlet-centric or Frameworks

  1. What should I use ???

    I'm building a web application that has 3 main parts.
    Part one is header which is totaly static with some links.
    Part two is content of the application and it consists of menu which resides on left side, and main content which covers right side.
    Part three is toolbar (with some buttons). This toolbar is not static, its elements are read from database.

    So I have many solutions to this problem but I don't know which one is the best. I don't have much experience in JSP so If someone can suggest me his/her solution.

    My solutions are:

    1. Something what is called "Page-centric design", where for each page that will my web application have, I must do:
    <%@ include page="header.jsp" %> staticaly
    <jsp:include page="leftmenu.jsp"/>
    main content part depends on what is clicked on leftmenu
    <jsp:include page="toolbar.jsp" />
    Though to theese pages have common variables, I should use Session variables. (i suppose)

    2. Something what is called "Servlet-centric design", where i make a Servlet in which I use:

    getServletContext().getRequestDispatcher("header.jsp").include(req,res);
    getServletContext().getRequestDispatcher("leftmenu.jsp").include(req,res);
    than i do some writing do main content and finally
    getServletContext().getRequestDispatcher("toolbar.jsp").include(req,res);

    3. To use some framework in which i create custom controls
    Control for header, leftmenu, toolbar,....
    This solutin is tough for me because i never worked in JSF or something similar.

    I want you to tell me your solution to this problem if solutions of mine are not corresponding for this.

    If the solution is "frameworks" please tell me which one would you recommend me.

    Thanks, I'm in real dilemma.

    Threaded Messages (2)

  2. Framework[ Go to top ]

    Just use Tiles, you can then separate the header footer body content, etc. into different templates. Tiles also supports inheritance of pages as well. Very cool!
  3. What should I use ???I'm building a web application that has 3 main parts.Part one is header which is totaly static with some links.Part two is content of the application and it consists of menu which resides on left side, and main content which covers right side.Part three is toolbar (with some buttons). This toolbar is not static, its elements are read from database.So I have many solutions to this problem but I don't know which one is the best. I don't have much experience in JSP so If someone can suggest me his/her solution.My solutions are:1. Something what is called "Page-centric design", where for each page that will my web application have, I must do:<%@ include page="header.jsp" %> staticaly<jsp:include page="leftmenu.jsp"/>main content part depends on what is clicked on leftmenu<jsp:include page="toolbar.jsp" />Though to theese pages have common variables, I should use Session variables. (i suppose)2. Something what is called "Servlet-centric design", where i make a Servlet in which I use:getServletContext().getRequestDispatcher("header.jsp").include(req,res);getServletContext().getRequestDispatcher("leftmenu.jsp").include(req,res);than i do some writing do main content and finallygetServletContext().getRequestDispatcher("toolbar.jsp").include(req,res);3. To use some framework in which i create custom controlsControl for header, leftmenu, toolbar,....This solutin is tough for me because i never worked in JSF or something similar.I want you to tell me your solution to this problem if solutions of mine are not corresponding for this.If the solution is "frameworks" please tell me which one would you recommend me. Thanks, I'm in real dilemma.

    If you are the only one coding this application and feel perfectly fine coding it at the Servlet level then you can probably just continue that route. However if this app is meant for a larger development made up of both Java developers and more generic Web developers, then I would definitely steer towards a page-based development framework.

    If your probably is only with inclusion of pages, then using JSP includes or bumping it up to Tiles as a valid recommendation.

    If you wish to make custom controls, you could use the standard JSF, or other opensource fwks such as Tapestry.

    Each of these UI fwks have their own distinctions, so I'd say just try them out for yourself and see which one you like best.