hi, i am new to struts frame work here i have little bit of confusion that whether the struts-config.xml file calls controller or model
as far as i know is the a class whcih extends Action (class) is told to be controller
so controller must be called first and then it must call model (which has got setters and getters)
but unfortunatley it is not correct because i have seen it in the console window by placing some debug statements(SOP) in model class and started the application by sending a request from a jsp page which contains some text fields and a submit button
so here when i press a submit button it internally calls model and then it calls the controller class (the class which extends Action)
But according to struts framework specification the flow is like this.. after submitting the request it checks the path in struts-config.cml file and the it forwards the request to controller and then it forwards to model(bussiness logic) and then returns back to jsp page.
please please ... can any one explain me what happens internally ?
thanks in advance
A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
so controller must be called first and then it must call model (which has got setters and getters) but unfortunatley it is not correct
Hi saikrishna, the model class is not the one which has getXXX() or setXXX(). It the one which contains the business logic of the application. In the Action class we pass the form in the execute method. public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException thus what you are referring to as model is the Form(which extends ActionForm /ValidatorForm). It is called internally. Hope it clears your doubt. Regards Roshani
There are different views on this, but my take is this...Struts does not provide any features that fulfill the Model role. The Model is your database, your business objects, or what ever you use to implement your middle tier. I would place ActionForm classes into the View portion. They are just there to support your JSP and to pass data back and forth between the JSP and Action.