CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.




Get it now !!
Send your Resume to 6000 Companies

Search Interview Questions

Question: What is struts flow? Explain in detail

Answer: Struts is a open source implementation of MVC design pattern to develop large scale web applications.Struts framework makes it easier to design realible,scalable web applications in java.Struts is not only thread safe but also thread dependent.It instantiates each action once and allows others to be threaded through the original object.Struts reduces the for redundant jsp's.ActionForm stratagy reduces the need of sub class hierarchy.

Struts is a light weight package.It consists of 5 core packages and 5 tag lig directories.



Category Struts Interview Questions & Answers - Exam Mode / Learning Mode
Rating (0.8) By 628 users
Added on 8/17/2011
Views 7840
Rate it!
Question: What is struts flow? Explain in detail


Answer:

Struts is a open source implementation of MVC design pattern to develop large scale web applications.Struts framework makes it easier to design realible,scalable web applications in java.Struts is not only thread safe but also thread dependent.It instantiates each action once and allows others to be threaded through the original object.Struts reduces the for redundant jsp's.ActionForm stratagy reduces the need of sub class hierarchy.

Struts is a light weight package.It consists of 5 core packages and 5 tag lig directories.
Source: CoolInterview.com


whenever client send request first it goes to CONTROLLER part(ActionServlet)it reads the request data& decides about which action should be performed to process the client request after that it forwards to the appropriate action class(MODEL part)where the functionality code(bussiness logic) will be there, from this MODEL part the control goes back to CONTROLLER part from here the appropriate jsp pages(VIEW part) can be picked up for presenthing(displaying) the result on the clients browser. Source: CoolInterview.com

Answered by: ranjith yadav | Date: 10/5/2007 | Contact ranjith yadav Contact ranjith yadav

when ever client sends a request, first it will reads the web.xml and creates a action servlet object and wc(webcontainer) calls the init()on action servlet.The struts code that is part of a init()reads the information that is available in the StrutsConfig.xml and executes the appropriate action class with the help of action mapping that is part of a SC.xml. Source: CoolInterview.com

Answered by: madhu | Date: 10/27/2008 | Contact madhu Contact madhu

Struts is a framework with set of cooperating classes, servlets and JSP tags that make up a reusable MVC 2 design.

> Client (Browser): A request from the client browser creates an HTTP request. The Web container will
respond to the request with an HTTP response, which gets displayed on the browser.
> Controller (ActionServlet class and Request Processor class): The controller receives the request from the browser, and makes the decision where to send the request based on the struts-config.xml.
Design pattern: Struts controller uses the command design pattern by calling the Action classes based on the configuration file struts-config.xml and the RequestProcessor class?s process() method uses template
method design pattern (Refer Q11 in How would you go about ? section) by calling a sequence of methods
like:
? processPath(request, response):- read the request URI to determine path element.
?processMapping(request,response):- use the path information to get the action mapping
?processRoles(request,respose,mapping):- Struts Web application security which provides an authorization scheme. By default calls request.isUserInRole(). For example allow /addCustomer action if the role is executive.
<action path=?/addCustomer? roles=?executive?>
?processValidate(request,response,form,mapping):- calls the vaildate() method of the ActionForm.
?processActionCreate(request,response,mapping):- gets the name of the action class from the ?type? attribute of the <action> element.
?processActionPerform(req,res,action,form,mapping):- This method calls the execute method of the Action class which is where business logic is written.
> Business Logic (Action class): The Servlet dispatches the request to Action classes, which act as a thin wrapper to the business logic (The actual business logic is carried out by either EJB session beans and/or plain Java classes). The action class helps control the workflow of the application. (Note: The Action class
should only control the workflow and not the business logic of the application). The Action class uses the Adapter design pattern
> ActionForm class: Java representation of HTTP input data. They can carry data over from one request to another, but actually represent the data submitted with the request.
> View (JSP): The view is a JSP file. There is no business or flow logic and no state information. The JSP should just have tags to represent the data on the browser.
ActionServlet class is the controller part of the MVC implementation and is the core of the framework. It processes user requests, determines what the user is trying to achieve according to the request, pulls data from
the model (if necessary) to be given to the appropriate view, and selects the proper view to respond to the user.
As discussed above ActionServlet class delegates the grunt of the work to the RequestProcessor and Action classes.
The ActionForm class maintains the state for the Web application. ActionForm is an abstract class, which is subclassed for every input form model. The struts-config.xml file controls, which HTML form request maps to
which ActionForm.
The Action class is a wrapper around the business logic. The purpose of the Action class is to translate the HttpServletRequest to the business logic. To use the Action class, subclass and overwrite the execute() method.
The actual business logic should be in a separate package or EJB to allow reuse of business logic in protocol independent manner (ie the business logic should be used not only by HTTP clients but also by WAP clients, EJB clients, Applet clients etc). Source: CoolInterview.com

Answered by: modi | Date: 2/1/2009 | Contact modi Contact modi

Struts is a framework that follows MVC2 design pattern. Below is the high level flow of struts framework.

Whenever user submits the JSP page, lets assume login page, whenever user gives user name and password and clicks on submit, first it goes to controller (struts-config.xml) and verifies the correcponding action like in login.jsp, if user clicks on SUBMIT button suppose it should go to /login.do, then corresponding login action will be invoked in struts-config.xml.

Based on the validate parameter value of struts action, control will go to either form.Validate() (if validate=true in struts-config) or action.performAction() (if validate=false in struts-config), and once the form validate is executed with out any action errors, action class will be executed and from action class --> command class --> Service class --> DAO Class and once all the business logic is done then based on the <forward> tag in action of struts config corresponding view will be displayed.

This is the high level flow.

Source: CoolInterview.com

Answered by: Venu | Date: 12/22/2009 | Contact Venu Contact Venu

Struts is an MVC2 framework that provides utilites like "Tiles","Validator Pluggin" and custom Tags Libraries(JSP Tags and HTML Tags) for developing Web applications.

It was originally created by Craig R. McClanahan and then donated to the Jakarta project of the Apache Software Foundation in 2000.

Struts application contains following:
1) Centralized File-based configuration (struts-config.xml)
Action Servlet (Controller)

2) JSP/HTML Pages (View)

3) Java Beans (Model)

Generally, Struts 1.2 is used to build a project, despite Struts 2.0 has been launched. Source: CoolInterview.com

Answered by: Preetesh | Date: 4/27/2010 | Contact Preetesh Contact Preetesh


If you have the better answer, then send it to us. We will display your answer after the approval

Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.

Post your answer here

Inform me about updated answers to this question.
Related Questions
View Answer
What r the disadvantages of struts?

View Answer
Why do we override the execute method is struts? Plz give me the details?

View Answer
What is Action Class. What are the methods in Action class

View Answer
What are the core classes of struts?

View Answer
What is the difference between Struts 1.0 and Struts 1.1
View Answer
What are the Important Components of Struts?



View Answer
What part of MVC does Struts represent

View Answer
How you will save the data across different pages for a particular client request usingStruts

View Answer
Is there any way to put my custom name to LIB folder which i am going to place in WEB-INF folder of struts application?




View Answer
Can i use bc4j with spring framwork

View Answer
Does Struts provide support for Validator & Tiles by default ?




View Answer
In struts, if any changes are made to before the request reaches to actionservlet, where you do the changes?

View Answer
In struts what happens if made any changes in actionservlet?

View Answer
In struts why we use jsp as presentation layer? can we use servlet as presentation layer?

View Answer
In struts how can i validate the values filled into the text boxes or else using DynaValidatorForm,without using javascript.
Actually with javascript it is working perfect but not without javascript, and i want without javascript?

View Answer
What is the use of ActionForm class, Describe it's Life Cycle

View Answer
What is the difference between strsuts 1.0 and struts 1.1 ?













View Answer
How can we work struts on Eclipse? What is the best plugin for this?

View Answer
What are the drawbacks of Struts

























View Answer
What is the difference between a normal servlet and action servlet?

View Answer

Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

View All Struts Interview Questions & Answers - Exam Mode / Learning Mode




India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.8125 Seconds