Designing presentation layer servlet classes

Discussion in 'Java' started by 2BaCook, Nov 10, 2003.

  1. 2BaCook

    2BaCook Guest

    I was wondering when writing a basic web program (typical 4-tier
    architecture) having a presentation layer that all extends
    HttpServlet... why not have a class BaseUI that extends HttpServlets
    and then have all my other UI classes extend from BaseUI? I have seen
    examples in texts just showing each UI class to extend just from
    Servlets, so I figure this is wrong but I do not know why.
    Thanks!
     
    2BaCook, Nov 10, 2003
    #1
    1. Advertising

  2. 2BaCook

    VisionSet Guest

    "2BaCook" <> wrote in message
    news:...
    > I was wondering when writing a basic web program (typical 4-tier
    > architecture) having a presentation layer that all extends
    > HttpServlet... why not have a class BaseUI that extends HttpServlets
    > and then have all my other UI classes extend from BaseUI? I have seen
    > examples in texts just showing each UI class to extend just from
    > Servlets, so I figure this is wrong but I do not know why.
    > Thanks!


    I take it you not rendering in a browser?

    --
    Mike W
     
    VisionSet, Nov 10, 2003
    #2
    1. Advertising

  3. 2BaCook wrote:

    > I was wondering when writing a basic web program (typical 4-tier
    > architecture) having a presentation layer that all extends
    > HttpServlet... why not have a class BaseUI that extends HttpServlets
    > and then have all my other UI classes extend from BaseUI? I have seen
    > examples in texts just showing each UI class to extend just from
    > Servlets, so I figure this is wrong but I do not know why.
    > Thanks!


    The question of specific technology choice aside, yes, you could do
    that. But why? What do you stand to gain?


    John Bollinger
     
    John C. Bollinger, Nov 10, 2003
    #3
  4. "2BaCook" <> schrieb im Newsbeitrag
    news:...
    > I was wondering when writing a basic web program (typical 4-tier
    > architecture) having a presentation layer that all extends
    > HttpServlet... why not have a class BaseUI that extends HttpServlets
    > and then have all my other UI classes extend from BaseUI? I have seen
    > examples in texts just showing each UI class to extend just from
    > Servlets, so I figure this is wrong but I do not know why.
    > Thanks!


    I don't think it's wrong to use a superclass for all servlets (there's only
    an insignificant loss of performance). but I'm wondering about servlets as
    UI classes. Usually a state-of-the-art application separates the model
    (business logic, database access) from the view (generating the html
    output). therefore you could consider using the servlets for executing
    business logic and forwarding the request to jsps for presentation.
    Additionally you would gain flexibility by using some MVC framework like
    Struts or similar.

    Reini
     
    Reinhold Erler, Nov 11, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. et
    Replies:
    2
    Views:
    1,921
  2. dan
    Replies:
    25
    Views:
    1,341
    Uncle Bob (Robert C. Martin)
    Oct 28, 2003
  3. Universe
    Replies:
    1
    Views:
    477
    Universe
    Oct 24, 2003
  4. Ily
    Replies:
    2
    Views:
    347
    Robert Haken [MVP]
    Oct 13, 2006
  5. Dhananjay
    Replies:
    1
    Views:
    1,127
    sloan
    Dec 18, 2006
Loading...

Share This Page