• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

why struts why not servlets?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

I am learning struts from last few days.What I get to know about struts is it's used for maintaining the MVC architecture.But we can use servlets for the same purpose. So why we need to go for struts? Whats special about struts? Please clarify this.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Servlets have their place. I use them occasionally when I have some simple functionality I need to get done. However, if you write a couple of non-trivial applications, you'll probably find yourself following the Front Controller Pattern, where one servlet is configured to dispatch requests to some sort of handler. It is this pattern that Struts is modelled after. It has some other functionality, like form handling, validation, a tag library and so on. Basically, Struts takes care of the ugly details so you can focus more on getting your work done (which is true for most any framework, of course).
BTW, if you are just learning Struts, do yourself a favor and learn Struts 2. It fixes some of the big problems with the Struts 1.x series.
 
Manjunath Chumbalakar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks Joe.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The useful part of Servlet is the API between the web server (specifically the servlet container) and you application. This is the form the HTTP request is received in Java program and the HTTP response is provided by Java program. That includes access to Session too. Hardly it will go away any soon and all the (about 50) Java web frameworks including Struts 2 are build above that API. Programming just servlets may turn to be pretty low level, the frameworks each try to make web programming more clear and easy, each in its own way.
 
Manjunath Chumbalakar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks aleksey
reply
    Bookmark Topic Watch Topic
  • New Topic