jQuery in Action, 3rd edition
The moose likes Struts and the fly likes why struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "why struts" Watch "why struts" New topic

why struts

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

Could someone tell me why struts are used. What are the benefits given by struts. Why is struts so popular.
Gimmi some good links to struts tutorial on the net for struts.

friso jonge
Ranch Hand

Joined: Aug 06, 2002
Posts: 41
answer to both of your questions....
Jesse Beaumont
Ranch Hand

Joined: May 30, 2002
Posts: 43
Struts does a whole lot of stuff, but the main focus of the struts is to give you an MVC framework to build on. Struts does a lot of the legwork associated with this for you (e.g. wrapping up the request object, storing the values in your object, transfering the object representation to the controller (ActionServlet and Action Class) and then reinserting the values from your transfer object back into the relevant places as you reconstruct the response page)
Struts also has support for XML driven validation (via a jakarta-commons package), display generation with JSP custom tags, database access, support for file upload, and lots of other goodies.
The framework is just another (rather large) step towards not having to worry about developing infrastructure and being able to concentrate on the business logic and the stuff that matters to the client. Reduced time to market and all those other points that are commonly touted at this point.
Hope that gives you a starter.

---<br />Time flies like an arrow,<br />Fruit flies like a banana
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi Pradeep,
I generally agree with Jesse's opinion. From a more distant point of view Struts is a framework for the presentation tier of web applications. It can be used as web presentation layer of J2EE applications (keyword: Enterprise JavaBeans), too.
The Model-View-Controller Design-Pattern Struts uses and Jesse mentioned is used to communicate between a Http client and the application. A Servlet functions as the Controller and organizes the communication. It checks the Request and forwards it to the Model and/or the View - more or less like a switch. In the View Struts uses JSP. (Actually, I wrote a add-on framework to use Struts with XSLT: Check out http://it.cappuccinonet.com/strutscx). The Model is outside the presentation tier and usually contains all the business logic and/or communication with the data storage (business tier, integration tier).
If you dive more into the Struts framework you'll stumble over the ActionForm classes which maybe are the most difficult part to understand. Don't mix ActionsForms with the Model. ActionForms are JavaBeans which encapsulate information to transport it in between the Http client and the application.
If you do use Sun's J2EE or you are building a Java based web application you seriously should consider to use Struts. But: Because Struts uses Servlets it is fixed on web applications.
Berny Woehrlin
Ted Husted
Ranch Hand

Joined: Dec 02, 2002
Posts: 37
These are all excellent response, but I thought it might be worthwile to add a quote from the first page of the Struts in Action book:
"Struts is open source software that helps developers build web applications quickly and easily. Struts relies on standard technologies�such as JavaBeans, Java
servlets, and JavaServer Pages (JSP)�that most developers already know how to use. By taking a standards-based, �fill-in-the-blanks� approach to software development, Struts can alleviate much of the time-consuming grunt work that comes
with every new project."
HTH, Ted.

<a href="http://husted.com/struts/book.html" target="_blank" rel="nofollow">Struts in Action</a>
I agree. Here's the link: http://aspose.com/file-tools
subject: why struts
jQuery in Action, 3rd edition