Struts is an open source MVC architecture created to make it easier for developers to build web applications based on Java Servlet and Java Server pages . In a J2EE based application, MVC architecture is used for separating business layer functionality from Presentation layer functionality represented by JSPs (the view) using an intermediate servlet based controller.
The incoming HTTP requests are routed to a central controller, which in turn interprets and delegates the request to the appropriate request handlers.
Struts also provides the following modules like
Struts Validator for form validation.
Tiles for assembling composite views.
Internationalization
Exception Handling
Logging
Struts Components
1) Web.xml :
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
Make sure that all the requests URI format will be like 2) Action Class : 3) struts-config.xml: 4) Model in Struts: This represents the business logic layer. Struts doesn’t offer anything to create the model layer of the web application. 5) View in Struts : The view components in struts could be Java Server pages, HTML etc.
Leave a Reply