In the earlier section on the Action class (HelloAction.java), you saw how the Action class passed between itself and the View components using the setAttribute() and getAttribute() methods of the request object. Now let’s look at this process in a bit more detail.
When you pass an object from the ActionClass to the View component (a JSP page) using the request.setAttribute(), you need to provide a name, or string identifier, that the JSP file can use to retrieve the object with. In Struts applications, a convention has been adopted for using a file named Constants.java to define these names. Listing 3.6 contains the Constants.java file for the HelloWorld! application.