In an struts application,When struts-config.xml file load? and what is request processor? what is the purpose of request processor? last but not least where we write our business logic in struts? is it action class or bean class(model)
Joined: Jan 17, 2006
Go through the Struts Survival Guide by Srikanth Shenoy. It explains everything in detail.
First of all, the title for the question is misleading as this question does have more aspects out of struts-config.xml file.
When struts-config.xml file load?
As and when any request comes for the resource which requires the Struts ActionServlet to continue processing, the struts-config.xml file is coming into picture. To say with an example, when you say, *.do for the url-pattern, invoke the ActionServlet name which is mapped to the servlet-class of org.apache.struts.action.ActionServlet class!
But i m not too sure of it as it may depend on the Web or Application Server's nature!
what is request processor? what is the purpose of request processor?
RequestProcessor is one who handles and delegates the call to the execute() method of the appropriate Action classes. Same as how the service() method delegates the call to either doGet() or doPost() of a Servlet.
last but not least where we write our business logic in struts? is it action class or bean class(model)
Basically, the bean class being used as a Model is to just represent the data! Action class is the main point of invocation where you may start your flow of implementing the business logic.
You can have a bit of business logic implemented in the Action Class and/or call the other layers for continue with the actual business logic.