Lesson04.2_Struts as MVC Framework

Embed Size (px)

Citation preview

Struts Application Development

Struts As a MVC Framework FPT SOFTWARE TRAINING MATERIAL Internal use04e-BM/NS/HDCV/FSOFT v2/4What Are Struts?Apaches open source web application model view controller framework project!Takes MVC to the next level for web applications. FPT SOFTWARE TRAINING MATERIAL Internal use04e-BM/NS/HDCV/FSOFT v2/4Struts Collaboration Diagram

FPT SOFTWARE TRAINING MATERIAL Internal use04e-BM/NS/HDCV/FSOFT v2/4ActionServlet

action org.apache.struts.action.ActionServlet debug 2 config /WEB-INF/struts-config.xml

action *.do ActionServlet is provided by the framework.The Servlet must be mapped in the web.xml file.Must have configuration file mappedLastly, Map the *.do URI to the Action Servlet FPT SOFTWARE TRAINING MATERIAL Internal use04e-BM/NS/HDCV/FSOFT v2/4strut-config.xml

XML configuration fileAllows for:DataSource definitionLogical name definitions for FormsView mappingsLocalGlobal FPT SOFTWARE TRAINING MATERIAL Internal use04e-BM/NS/HDCV/FSOFT v2/4strut-config.xmlFor requests that hit URL=/logonThe frame work will invoke execute() on an instance of class com.codementor.LogonAction

Store request parameters in form variable LogonForm which is defined in another location in the xml document.

If the logical name returned by perform() is failure go to page /failure.jsp

If the Logical name returned by perform() is success go to /success.jsp