You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ranko Bijelonic <rb...@yahoo.com> on 2003/07/21 09:12:19 UTC

Struts MVC framework similar to that of a servlet container?

Hi.  I've been using Struts for a long time, and I've been very happy with
the framework.  However, a recent discussion on Sun's Java forums has left
me wondering if Struts is necessary.  It seems that the servlet container
itself provides an MVC framework very similar to that of Struts.  All that
is missing is some utilities and standardization.  I was wondering if there
is a flaw in my logic below, and if anyone had any comments.


In comparing these two MVC frameworks, the servlet container would be the
equivalent of the ActionServlet.  They both read their configuration files,
examine the incoming URL, and then forward the request to the configured
handler.  In the case of the servlet container the handlers are Servlet
classes, and in the case of Struts its the Action classes.  Both the
container and the ActionServlet will create an instance of their handler
when its requested the first time. The Servlet's service method and the
Action's execute method will call some domain logic and then select a view
to display to the user.  The Servlet can use RequestDispatchers to
encapsulate information about the view, and the Action will use an
ActionForward.  Doesn't this sound very similar?

It seems like we are adding a lot of complexity on top of the servlet spec
in order to get some common tasks done for us.  But that could probably be
better done by the servlet container itself.  For example, Struts
automatically populates the form class the developer specifies for a
particular Action.  But Sun could provide a standard Filter implementation
which does the same thing.  You can declare handlers for your exceptions in
the Struts configuration file, but you can also do it in the web.xml.  If
the functionality there is not quite the same, Sun can add a little to the
spec and we would get it.

My question is, is an application built in Struts really that much more
maintainable than one built with servlets?  Or if some common utilities
provided by the Struts container were provided by the servlet container,
would there be much difference?  It seems that would even be simpler.  Or
not?

ranko


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Struts MVC framework similar to that of a servlet container?

Posted by Ranko Bijelonic <rb...@yahoo.com>.
I understand the point of frameworks, I was just wondering if the one Struts
aims to provide one that is already largely provided by the container.

-----Original Message-----
From: Navjot Singh [mailto:navjot.s@net4india.net]
Sent: Monday, July 21, 2003 4:14 AM
To: Struts Users Mailing List
Subject: RE: Struts MVC framework similar to that of a servlet
container?


hi,

No doubt, they are vaguely the same.
After all STRUTS is based on container. BUT struts make your life EASY.

How? By providing scalable and reusable code - base principle of frameworks.

1. Frameworks are the semi-complete applications. They are standardized
answer to the very common set of requirements that almost every application
faces in it's life cycle.
2. Containers provide some *services* within some *boundaries*.
   So does STRUTS, but in more refined & standardized form.

If you see around, there is always some base code.
 APIs -> Base libraries -> Facades and so on.

Some one writes an encapsulation to make his job easy AND still there is
someone who may like to write more encapsulated code. You will definitely
find discussions on this list about extending Action class. Why is that?
Everyone knows.

There are always some set of requirements that occur more frequently and
they need to put together as reusable piece of code and that's why STRUTS is
here.

regards
Navjot Singh

|-----Original Message-----
|From: Ranko Bijelonic [mailto:rbijelonic@yahoo.com]
|Sent: Monday, July 21, 2003 12:42 PM
|To: struts-user@jakarta.apache.org
|Subject: Struts MVC framework similar to that of a servlet container?
|
|
|
|Hi.  I've been using Struts for a long time, and I've been very happy with
|the framework.  However, a recent discussion on Sun's Java forums has left
|me wondering if Struts is necessary.  It seems that the servlet container
|itself provides an MVC framework very similar to that of Struts.  All that
|is missing is some utilities and standardization.  I was wondering if there
|is a flaw in my logic below, and if anyone had any comments.
|
|
|In comparing these two MVC frameworks, the servlet container would be the
|equivalent of the ActionServlet.  They both read their configuration files,
|examine the incoming URL, and then forward the request to the configured
|handler.  In the case of the servlet container the handlers are Servlet
|classes, and in the case of Struts its the Action classes.  Both the
|container and the ActionServlet will create an instance of their handler
|when its requested the first time. The Servlet's service method and the
|Action's execute method will call some domain logic and then select a view
|to display to the user.  The Servlet can use RequestDispatchers to
|encapsulate information about the view, and the Action will use an
|ActionForward.  Doesn't this sound very similar?
|
|It seems like we are adding a lot of complexity on top of the servlet spec
|in order to get some common tasks done for us.  But that could probably be
|better done by the servlet container itself.  For example, Struts
|automatically populates the form class the developer specifies for a
|particular Action.  But Sun could provide a standard Filter implementation
|which does the same thing.  You can declare handlers for your exceptions in
|the Struts configuration file, but you can also do it in the web.xml.  If
|the functionality there is not quite the same, Sun can add a little to the
|spec and we would get it.
|
|My question is, is an application built in Struts really that much more
|maintainable than one built with servlets?  Or if some common utilities
|provided by the Struts container were provided by the servlet container,
|would there be much difference?  It seems that would even be simpler.  Or
|not?
|
|ranko
|
|
|---------------------------------------------------------------------
|To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
|For additional commands, e-mail: struts-user-help@jakarta.apache.org
|
|


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Struts MVC framework similar to that of a servlet container?

Posted by Navjot Singh <na...@net4india.net>.
hi,

No doubt, they are vaguely the same.
After all STRUTS is based on container. BUT struts make your life EASY.

How? By providing scalable and reusable code - base principle of frameworks.

1. Frameworks are the semi-complete applications. They are standardized
answer to the very common set of requirements that almost every application
faces in it's life cycle.
2. Containers provide some *services* within some *boundaries*.
   So does STRUTS, but in more refined & standardized form.

If you see around, there is always some base code.
 APIs -> Base libraries -> Facades and so on.

Some one writes an encapsulation to make his job easy AND still there is
someone who may like to write more encapsulated code. You will definitely
find discussions on this list about extending Action class. Why is that?
Everyone knows.

There are always some set of requirements that occur more frequently and
they need to put together as reusable piece of code and that's why STRUTS is
here.

regards
Navjot Singh

|-----Original Message-----
|From: Ranko Bijelonic [mailto:rbijelonic@yahoo.com]
|Sent: Monday, July 21, 2003 12:42 PM
|To: struts-user@jakarta.apache.org
|Subject: Struts MVC framework similar to that of a servlet container?
|
|
|
|Hi.  I've been using Struts for a long time, and I've been very happy with
|the framework.  However, a recent discussion on Sun's Java forums has left
|me wondering if Struts is necessary.  It seems that the servlet container
|itself provides an MVC framework very similar to that of Struts.  All that
|is missing is some utilities and standardization.  I was wondering if there
|is a flaw in my logic below, and if anyone had any comments.
|
|
|In comparing these two MVC frameworks, the servlet container would be the
|equivalent of the ActionServlet.  They both read their configuration files,
|examine the incoming URL, and then forward the request to the configured
|handler.  In the case of the servlet container the handlers are Servlet
|classes, and in the case of Struts its the Action classes.  Both the
|container and the ActionServlet will create an instance of their handler
|when its requested the first time. The Servlet's service method and the
|Action's execute method will call some domain logic and then select a view
|to display to the user.  The Servlet can use RequestDispatchers to
|encapsulate information about the view, and the Action will use an
|ActionForward.  Doesn't this sound very similar?
|
|It seems like we are adding a lot of complexity on top of the servlet spec
|in order to get some common tasks done for us.  But that could probably be
|better done by the servlet container itself.  For example, Struts
|automatically populates the form class the developer specifies for a
|particular Action.  But Sun could provide a standard Filter implementation
|which does the same thing.  You can declare handlers for your exceptions in
|the Struts configuration file, but you can also do it in the web.xml.  If
|the functionality there is not quite the same, Sun can add a little to the
|spec and we would get it.
|
|My question is, is an application built in Struts really that much more
|maintainable than one built with servlets?  Or if some common utilities
|provided by the Struts container were provided by the servlet container,
|would there be much difference?  It seems that would even be simpler.  Or
|not?
|
|ranko
|
|
|---------------------------------------------------------------------
|To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
|For additional commands, e-mail: struts-user-help@jakarta.apache.org
|
|


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Struts MVC framework similar to that of a servlet container?

Posted by Sandeep Takhar <sa...@yahoo.com>.
there's a lot of stuff it gives you out of the box.

1. solid code
2. validation framework
3. tile framework
4. auto-population framework
5. role based actions
6. xml configuration of all the links or actions of
your application
7. best practices framework bundling (scaffolding)
complete with examples (many years of experience went
into this one).
8. ease of use

I am missing about twice as many things from this list
I am sure...

the servlet container is sun's way of making sure that
what you build is timeless (and works on their
servers...)

Struts solves common problems across every typical
application.  The servlet container does not solve
these typical problems.  Struts is really a pattern...

sandeep
--- Ranko Bijelonic <rb...@yahoo.com> wrote:
> 
> Hi.  I've been using Struts for a long time, and
> I've been very happy with
> the framework.  However, a recent discussion on
> Sun's Java forums has left
> me wondering if Struts is necessary.  It seems that
> the servlet container
> itself provides an MVC framework very similar to
> that of Struts.  All that
> is missing is some utilities and standardization.  I
> was wondering if there
> is a flaw in my logic below, and if anyone had any
> comments.
> 
> 
> In comparing these two MVC frameworks, the servlet
> container would be the
> equivalent of the ActionServlet.  They both read
> their configuration files,
> examine the incoming URL, and then forward the
> request to the configured
> handler.  In the case of the servlet container the
> handlers are Servlet
> classes, and in the case of Struts its the Action
> classes.  Both the
> container and the ActionServlet will create an
> instance of their handler
> when its requested the first time. The Servlet's
> service method and the
> Action's execute method will call some domain logic
> and then select a view
> to display to the user.  The Servlet can use
> RequestDispatchers to
> encapsulate information about the view, and the
> Action will use an
> ActionForward.  Doesn't this sound very similar?
> 
> It seems like we are adding a lot of complexity on
> top of the servlet spec
> in order to get some common tasks done for us.  But
> that could probably be
> better done by the servlet container itself.  For
> example, Struts
> automatically populates the form class the developer
> specifies for a
> particular Action.  But Sun could provide a standard
> Filter implementation
> which does the same thing.  You can declare handlers
> for your exceptions in
> the Struts configuration file, but you can also do
> it in the web.xml.  If
> the functionality there is not quite the same, Sun
> can add a little to the
> spec and we would get it.
> 
> My question is, is an application built in Struts
> really that much more
> maintainable than one built with servlets?  Or if
> some common utilities
> provided by the Struts container were provided by
> the servlet container,
> would there be much difference?  It seems that would
> even be simpler.  Or
> not?
> 
> ranko
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org