The Six Basic Steps in Using Struts
There are six basics steps needed to implement the control flow just described.
1. Modify struts-config.xml. For basic Struts usage, this file should
contain three main sections: a table that maps incoming addresses to
Action objects (action entries), a table that maps return conditions
to JSP pages (forward entries), and a list of the beans used to handle
request parameters (form-bean entries).
2. Define a form bean. Rather than requiring you to call
request.getParameter for each incoming piece of query data,
Struts can instantiate and populate a bean representing the incoming
form data. This is one of the single most useful features of the Struts
framework.
3. Create the results beans. If the JSP page needs data resulting from
the business logic, then create results beans to hold the data. These
beans are nothing Struts-specific, but are normal beans as used in the
basic MVC architecture.
4. Define an Action class to handle the request. Struts automatically
invokes the execute method of the Action object specified in
the action entry of struts-config.xml. The execute method typically
uses the form bean to access request data submitted by the user,
invokes business logic and data-access logic, stores results beans based
on that logic, and calls mapping.findForward to designate the
result condition.
5. Create a form that invokes blah.do. Create an HTML form for the
user’s input. Use html:form to associate the form with a bean and to
specify the address that should handle the form submission. Use
html:text and related elements to gather user data and to associate
bean properties with the input elements.
6. Display the results in a JSP page. Write a JSP page to display the
results. Depending on the user input and business logic, you could
have more than one possible results page. Use bean:write or the
JSP EL to output bean properties.