Part 3. Building the view: tags and results
In part 2, we learned how the core of the framework processes each request. In particular, we learned how to write actions that contain the logic for each request, wrap that action logic with a stack of the appropriate interceptors, and take advantage of the framework’s powerful data transfer and type conversion mechanisms. Though we’ve been using JSP pages to render simple views for our actions, we haven’t gone into any of the details of the view layer. We now enter the part of the book that focuses on the view layer.
In Struts 2, the MVC view concerns are encapsulated in the result component. We’ve already become somewhat familiar with the result component even though we’ve said nothing regarding its details. In fact, actually developing results will be at least as rare as developing your own interceptors. Most of your development work will amount to little more than using built-in result types to hit JSP pages and Velocity templates. The built-in result types will handle the most common view-layer technologies, so you’ll probably go through a lot of code before you find yourself writing your own. Nonetheless, we’ll provide a detailed account of working directly with results in chapter 8.