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: Explain Struts navigation flow?

Answer: Struts Navigation flow.

1) A request is made from previously displayed view.
2) The request reaches the ActionServlet which acts as the controller .The ActionServlet Looksup the requested URI in an XML file (Struts-Config.xml) and determines the name of the Action class that has to perform the requested business logic.
3)The Action Class performs its logic on the Model Components associated with the Application.
4) Once The Action has been completed its processing it returns the control to the Action Servlet.As part of its return the Action Class provides a key to determine where the results should be forwarded for presentation.
5)The request is complete when the Action Servlet responds by forwarding the request to the view, and this view represents the result of the action.

Submitted by Vemuri Rama Krishna (iamvemuri @ yahoo . com )



Category Struts Interview Questions & Answers - Exam Mode / Learning Mode
Rating (0.7) By 482 users
Added on 1/3/2010
Views 9344
Rate it!
Question: Explain Struts navigation flow?
Answer:

Struts Navigation flow.

1) A request is made from previously displayed view.
2) The request reaches the ActionServlet which acts as the controller .The ActionServlet Looksup the requested URI in an XML file (Struts-Config.xml) and determines the name of the Action class that has to perform the requested business logic.
3)The Action Class performs its logic on the Model Components associated with the Application.
4) Once The Action has been completed its processing it returns the control to the Action Servlet.As part of its return the Action Class provides a key to determine where the results should be forwarded for presentation.
5)The request is complete when the Action Servlet responds by forwarding the request to the view, and this view represents the result of the action.

Submitted by Vemuri Rama Krishna (iamvemuri @ yahoo . com ) Source: CoolInterview.com


1.when ever user requests for something the control goes to the WEB.XML and checks the config info.
2.then the action form will be called and then reset() method will be called followed by validate() if and only if "validate" attribute of action definition in struts-config.xml is set true(action form does only field validations)
3.if the field validations are correct, appropriate action class will be selected from the struts-config.xml action definition. the execute() method will be called in the action class.
4.suppose the user has only 2 fields "username" "password"
actionform validates whether he has entered something or not. and now action class execute() method refers whether the user entered correct username and password.
if it was correct it will be forwared to success page. Source: CoolInterview.com

Answered by: RaghuJ | Date: 5/20/2009 | Contact RaghuJ Contact RaghuJ

Struts Navigation flow
-----------------------

Step-1 : At first when the application is started in the server the web.xml file will load and parsed.

Step-2: when request comes to the context or application, it will find out which servlet need to execute with the respective request, By default in Struts based we applications the ActionServlet is the receiver of every request so the container invokes the ActionServlet by using the ?web.xml? file details.

Ex:
<servlet>
<servlet-name>MyController</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyController</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>



Step-3: At first it will check whether the ActionServlet object is initialized or not if not it will create the ActionServlet object and initialize it.
Step-4: In the ActionServlet initialization, it'll do the following things

It will create the ModuleConfig object with the struts configuration file details (struts-config.xml) and create the RequestProcessor object and invokes RequestProcessor initialization method with ?ModuleConfig? and ?ActionServlet? objects as parameters to it.
Ex:
init( actionservlet,moduleConfig);

NOTE: We can do all this initialization steps at the begins of the server or application by using the <load-on-startup> tag in the ?web.xml? file for the ActionServlet.

Step-5: If the ActionServlet is already initialized then the container will invokes the ?doGet/doPost? method of the ActionServlet to process the request. In that doGet/doPost it simple transfer the controller to the RequestProcessor ?execute? method.

Step-6: For processing the request the RequestProcessor ?execute? method calls a sequence of ?procesXXX()? methods.

Few of the main processXXX() methods are :

I)processPath(): Identify and return the path component (from the request URI) that we will use to select an ActionMapping with which to dispatch. If no such path can be identified, create an error response and return null
II)processContent(): Set the default content type (with optional character encoding) for all responses if requested. NOTE - This header will be overridden automatically if a RequestDispatcher.forward call is ultimately invoked
III)processActionForm(): Retrieve and return the ActionForm associated with this mapping, creating and retaining one if necessary. If there is no ActionForm associated with this mapping, return null.
IV)processActionCreate():Return an Action instance that will be used to process the current request, creating a new one if necessary
V)processActionPerform():Ask the specified Action instance to handle this request. Return the ActionForward instance (if any) returned by the called Action for further processing.
VI)processForwardConfig(): Forward or redirect to the specified destination, by the specified mechanism. This method uses a ForwardConfig object instead an ActionForward.

Step-7: At last the RequestProcessor ?destroy()? method will invokes to destroy all the Action class objects.

Step-8: After that the ActionServlet ?destroy? method will invoke to destroy all the Modules and RequestProcessor objects

Step-9: Destroy the ActionServlet object.

Step-10: At the time of application getting shutdown the ActionServlet class will unload Source: CoolInterview.com

Answered by: Shaik Baji | Date: 4/20/2010 | Contact Shaik Baji Contact Shaik Baji


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 is the difference between ActionForm and DynaActionForm
View Answer
What is DispatchAction?
View Answer
How to call ejb from Struts?
View Answer
What are the various Struts tag libraries?
View Answer
What is the difference between ActionErrors and ActionMessages?
View Answer
How you will handle errors and exceptions using Struts?
View Answer
How you will save the data across different pages for a particular client request using Struts?
View Answer
What we will define in Struts-config.xml file. And explain their purpose?
View Answer
What is the purpose of tiles-def.xml file, resourcebundle.properties file, validation.xml file?
View Answer
What is Action Class? What are the methods in Action class?
View Answer
Explain about token feature in Struts?
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.65625 Seconds