Struts Framework

Why we use Struts framework in project?

Questions by jeenjustin

Showing Answers 1 - 33 of 33 Answers

Struts is nothing but implementation of MVC2 design pattern to develop web based appl. it supports and it is suited for any size of appln.

  Was this answer useful?  Yes

Struts framework is a open source frame work for developing webapplications. In this frame work, seperation between presentation  and business logic there. Struts have loosly coupled nature.  

  Was this answer useful?  Yes

aleemkh

  • Sep 17th, 2008
 

If you use struts, there will be only one Servlet which acts as a controller (MVC) pattern. If your webapp is very simple then there is no need to use struts. If the application is big like any banking application etc, then you should use Struts as it is very robust, makes the things simple, it Also has lot of readily available security features etc...

Java web application that consists of JSP as controller is an MVC1
architecture and web application which consists of Servlet as controller is
called as MVC2 architecture.


Struts is an open source framework which follows MVC2 architecture. We choose
to use struts framework while having more than one action.


For ex; if your form consists of more than one submit button i.e. like Edit,
Save, Delete
then we do go for struts.


We can also code the functionality in Servlets or JSP when we contain more
than one submit button but we have to use java script in the form and we have to
use no of if..else statement inside the controller.


Struts which is an open source framework which has some prebuilt classes like
action servlet as controller and most importantly we have additionally validator
framework available in struts.

biswranjan

  • Sep 24th, 2008
 

Struts frame work designed to follow Front controller Design pattern, where one controller should be responsible to handle request and response.
so in web.xml (deployment descriptor) only one conroller can be configured to handle requests and responses.

  Was this answer useful?  Yes

gauraw10

  • Oct 3rd, 2008
 

Struts follow MVC design pattern and model and view are attached with the controler so reusability of view and model occurs. In Struts there is centralised system and whole application controlled by controler so apply whole of the security at controler not at each page of application. 

By using Struts making projects as MVC architecture based web applications. The advantages are clean saperation of roles means we write the specified logic in that specified component only, logics are not mixed up, parallel development is possible, productivity is good, middleware services are implicit, Enhancement of the project is easy.

Struts Framework provides layered architecture which decouples the Model, View and Controller. Hence we can seperate businees logic from presentation logic.  Maintenance is easy. This is achieved by MVC 2 architecture. Here Only one controller is available (The ActionServlet) which delegates the requests to different actions.

How Struts works:

All Browser requests are submitted to Struts ActionServlet.

  • The Struts ActionServlet determines which Action Subclass to route to using the    mapping that is pre-configured in struts-config.xml.
  • The ActionServlet pass the control to the Action Subclass (actually delegates this work to Request Processor)
  • When the HTML form is Submitted, the ActionForm object is automatically populated with the form data.
  • The Action Subclass can Access the form data that is stored in the ActionForm   Subclass. This ActionForm subclass is passed to the bakend business logic for further actions.
  • The Action  Subclass the invoke backend business logic and get the result and forward it to client.

Benifits of using struts framework are [these are the reasons we should use struts]:-

(1) Its based on MVC architecture [MVC-2 to be specific] and brings a clear line of demarkation between Controller logic, Model logic and the presentation layer.

(2) This provides a rich set of libraries who features we can use [re-use] to speed up our development process.


Thanks,
Vinay

  Was this answer useful?  Yes

Generally in any project we should use any design pattern to make project success. So many people find some sort of problems in their design but atlast they provide one solution to those common problems in this way one design pattern exists in the world. So struts is also one type of design pattern which is agreed by many people in the world.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions